webview.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <page-layout class="webview-container">
  3. <web-view class="webview" :src="url" @bindmessage="message"></web-view>
  4. <u-share-action-sheet :show.sync="showShare" :show-info="shareInfo" />
  5. </page-layout>
  6. </template>
  7. <script>
  8. import UShareActionSheet from '@/components/common/u-share-action-sheet'
  9. import PageLayout from "@/components/layout/page-layout";
  10. export default {
  11. components: {
  12. PageLayout,
  13. UShareActionSheet
  14. },
  15. data() {
  16. return {
  17. url: '',
  18. showShare: false,
  19. shareInfo:{}
  20. }
  21. },
  22. onLoad(options) {
  23. this.url = decodeURIComponent(options.url)
  24. console.log(options.url)
  25. },
  26. methods: {
  27. message(e) {
  28. if (e && e.event_name === 'collect') {
  29. }
  30. if (e && e.event_name === 'share') {
  31. console.log(e)
  32. this.showShare = true
  33. this.shareInfo = {
  34. title: e.title,
  35. path: url,
  36. imageUrl: e.image_url
  37. }
  38. console.log(this.shareInfo)
  39. }
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .webview-container {
  46. display: flex;
  47. flex-direction: column;
  48. }
  49. .webview {
  50. flex: 1;
  51. }
  52. </style>