webview.vue 859 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <view>
  3. <web-view :src="url" @message="onMessage"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. import config from "@/config";
  8. export default {
  9. data() {
  10. return {
  11. url: ''
  12. }
  13. },
  14. onLoad(body) {
  15. uni.$on('reloadElement', () => {
  16. this.url = config.baseUrl + '/webview/document/editor.html?token=' + uni.getStorageSync('token') +
  17. '&id=' + body.id + '&contractId=' + body.contractId + '&time=' + new Date().getTime() +
  18. '&userId=' + this.$store.getters.user.userId;
  19. })
  20. this.url = config.baseUrl + '/webview/document/editor.html?token=' + uni.getStorageSync('token') +
  21. '&id=' + body.id + '&contractId=' + body.contractId + '&time=' + new Date().getTime() + '&userId=' + this
  22. .$store.getters.user.userId;
  23. },
  24. methods: {
  25. onMessage(data) {}
  26. }
  27. }
  28. </script>
  29. <style>
  30. </style>