web-view.uvue 903 B

12345678910111213141516171819202122232425262728293031
  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 progress = ref(1)
  6. const webviewSrc = ref('')
  7. var isLoading = ref(true)
  8. onMounted(() => {
  9. webviewSrc.value = router.query().src
  10. progress.value = router.query().progress
  11. })
  12. function handleMessage(e) {
  13. var pages = getCurrentPages();
  14. const prevPage = pages[pages.length - 2];
  15. (prevPage as any).status = "success"
  16. }
  17. function handleLoad() {
  18. isLoading.value = false
  19. console.log('handleLoad')
  20. }
  21. onShow(() => {
  22. var pages = getCurrentPages();
  23. const prevPage = pages[pages.length - 2];
  24. (prevPage as any).status = "test"
  25. })
  26. </script>
  27. <template>
  28. <Loading v-show="isLoading" />
  29. <web-view :src="webviewSrc" class="w-full h-full" @message="handleMessage" @load="handleLoad"></web-view>
  30. </template>
  31. <style lang="less" scoped></style>