|
|
@@ -1,13 +1,15 @@
|
|
|
<script setup lang='ts'>
|
|
|
-import { ref, onMounted, watchEffect } from 'vue'
|
|
|
+import { ref, onMounted, onUnload } from 'vue'
|
|
|
import Loading from '@/components/loading.uvue'
|
|
|
import { router } from '@/.cool'
|
|
|
const progress = ref(1)
|
|
|
const webviewSrc = ref('')
|
|
|
+const showWebview = ref(false)
|
|
|
var isLoading = ref(true)
|
|
|
onMounted(() => {
|
|
|
webviewSrc.value = router.query().src
|
|
|
progress.value = router.query().progress
|
|
|
+ showWebview.value = true
|
|
|
})
|
|
|
|
|
|
function handleMessage(e) {
|
|
|
@@ -24,15 +26,15 @@ function onWebError() {
|
|
|
webviewSrc.value = router.query().src + '?t=' + t
|
|
|
console.log('onWebError')
|
|
|
}
|
|
|
-onShow(() => {
|
|
|
- var pages = getCurrentPages();
|
|
|
- const prevPage = pages[pages.length - 2];
|
|
|
- (prevPage as any).status = "test"
|
|
|
+// iOS WKWebView 在页面销毁后音频不会自动停止,需要先销毁 webview
|
|
|
+onUnload(() => {
|
|
|
+ showWebview.value = false
|
|
|
+ webviewSrc.value = ''
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
<Loading v-show="isLoading" />
|
|
|
- <web-view :src="webviewSrc" id="web-view" class="w-full h-full" @message="handleMessage" @load="handleLoad"
|
|
|
- @error="onWebError"></web-view>
|
|
|
+ <web-view v-if="showWebview" :src="webviewSrc" id="web-view" class="w-full h-full" @message="handleMessage"
|
|
|
+ @load="handleLoad" @error="onWebError"></web-view>
|
|
|
</template>
|
|
|
<style lang="less" scoped></style>
|