index.vue 694 B

12345678910111213141516171819202122232425262728293031323334
  1. <route lang="json5" type="page">
  2. {
  3. layout: 'default',
  4. style: {
  5. navigationBarTitleText: '上传文件',
  6. },
  7. }
  8. </route>
  9. <template>
  10. <view class="">
  11. <web-view :src="url" @message="handleMessage"></web-view>
  12. </view>
  13. </template>
  14. <script lang="ts" setup>
  15. const url = ref("")
  16. function handleMessage(data) {
  17. uni.removeStorageSync('fileList');
  18. // 判断是否有文件上传
  19. uni.setStorageSync('fileList', JSON.parse(data.detail.data))
  20. uni.navigateTo({
  21. url: `/pages/print/index?accept=all`,
  22. })
  23. }
  24. onLoad((option) => {
  25. if (option && option.url) url.value = decodeURIComponent(option.url) + "?t=" + new Date().getTime()
  26. })
  27. </script>
  28. <style lang="scss" scoped>
  29. </style>