web-view.uvue 862 B

123456789101112131415161718192021222324252627282930
  1. <script setup lang='ts'>
  2. import { ref, onMounted, watchEffect } from 'vue'
  3. import Loading from '@/components/loading.uvue'
  4. import { router } from '@/.cool'
  5. const webviewSrc = ref('')
  6. var isLoading = ref(true)
  7. onMounted(() => {
  8. webviewSrc.value = router.query().src
  9. })
  10. function handleMessage(e) {
  11. var pages = getCurrentPages();
  12. const prevPage = pages[pages.length - 2];
  13. (prevPage as any).status = "success"
  14. }
  15. function handleLoad() {
  16. isLoading.value = false
  17. console.log('handleLoad')
  18. }
  19. onShow(() => {
  20. var pages = getCurrentPages();
  21. const prevPage = pages[pages.length - 2];
  22. (prevPage as any).status = "test"
  23. })
  24. </script>
  25. <template>
  26. <Loading v-show="isLoading" />
  27. <web-view :src="webviewSrc + '?' + Math.random()" class="w-full h-full" @message="handleMessage"
  28. @load="handleLoad"></web-view>
  29. </template>
  30. <style lang="less" scoped></style>