webview.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. },
  25. methods: {
  26. message(e) {
  27. if (e && e.event_name === 'collect') {
  28. }
  29. if (e && e.event_name === 'share') {
  30. this.showShare = true
  31. this.shareInfo = {
  32. title: e.title,
  33. path: url,
  34. imageUrl: e.image_url
  35. }
  36. }
  37. }
  38. }
  39. }
  40. </script>
  41. <style lang="scss" scoped>
  42. .webview-container {
  43. display: flex;
  44. flex-direction: column;
  45. }
  46. .webview {
  47. flex: 1;
  48. }
  49. </style>