index.vue 789 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <web-view :src="url"></web-view>
  3. </template>
  4. <script setup>
  5. import { ref } from 'vue'
  6. import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  7. const url = ref('')
  8. onLoad((options) => {
  9. // 传入需要跳转的链接 使用web-view标签进行跳转
  10. url.value = decodeURIComponent(options.url)
  11. wx.showShareMenu({
  12. withShareTicket: true,
  13. menus: ['shareAppMessage', 'shareTimeline']
  14. })
  15. onShareAppMessage(() => {
  16. return {
  17. title: options?.title || '门墩儿 专注顶尖招聘',
  18. path: '/pages/addWebView/index?url=' + url.value
  19. }
  20. })
  21. onShareTimeline(() => {
  22. return {
  23. title: options?.title || '门墩儿 专注顶尖招聘',
  24. path: '/pages/addWebView/index?url=' + url.value
  25. }
  26. })
  27. })
  28. </script>