<script setup lang='ts'>
import { ref, onMounted, watchEffect } from 'vue'
import Loading from '@/components/loading.uvue'
import { router } from '@/.cool'
const menu2Items = [
  { id: '1', name: '观察', icon: 'https://oss.xiaoxiongcode.com/static/home/kanke.png' },
  { id: '2', name: '提问', icon: 'https://oss.xiaoxiongcode.com/static/home/lianxi.png' },
  { id: '3', name: '假设', icon: 'https://oss.xiaoxiongcode.com/static/home/shiyan.png' },
  { id: '4', name: '实验', icon: 'https://oss.xiaoxiongcode.com/static/home/riji.png' },
  { id: '5', name: '总结', icon: 'https://oss.xiaoxiongcode.com/static/home/riji.png' },
  { id: '6', name: '拓展', icon: 'https://oss.xiaoxiongcode.com/static/home/riji.png' },
]
const progress = ref(1)
const webviewSrc = ref('')
const isLoading = ref(true)
onMounted(() => {
  webviewSrc.value = router.query().src
  progress.value = router.query().progress
})
function handleMessage(e) {
  var pages = getCurrentPages();
  const prevPage = pages[pages.length - 2];
  (prevPage as any).status = "success"
}
function handleLoad() {
  console.log('handleLoad')
  isLoading.value = false
}
onShow(() => {
  var pages = getCurrentPages();
  const prevPage = pages[pages.length - 2];
  (prevPage as any).status = "test"
})
</script>
<template>
  <Loading v-show="isLoading" />
  <web-view :src="webviewSrc + '?' + Math.random()" class="w-full h-full" @message="handleMessage"
    @load="handleLoad"></web-view>
</template>
<style lang="less" scoped></style>
