webview.vue 579 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <view>
  3. <web-view v-if="webviewUrl" :src="webviewUrl" @message="message"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. import config from '@/config';
  8. export default {
  9. data() {
  10. return {
  11. webviewUrl: ''
  12. }
  13. },
  14. onLoad(body) {
  15. let path = decodeURIComponent(body.url);
  16. let link = path.indexOf('?') === -1 ? '?' : '&';
  17. this.webviewUrl = config.webviewUrl + path + link + 'token=' + uni.getStorageSync('shopMobileToken');
  18. },
  19. methods: {
  20. message(e) {
  21. console.log(e.detail);
  22. }
  23. }
  24. }
  25. </script>
  26. <style>
  27. </style>