红颜祸水
红颜祸水
  • 发布:2025-06-16 17:46
  • 更新:2025-06-16 17:46
  • 阅读:16

第二次进入web-view界面时,本地html不渲染

分类:uni-app

<template>
<view v-if="showWebview">
<web-view ref="webview" :src="Src" class="webview-class"></web-view>
</view>
</template>

<script>
import { Fit } from '@/common/fit.js'

export default {
data() {
return {
showWebview: false,
uuid: '',
modelId: '',
token: '',
sign: '',
Src:'/hybrid/html/proces.html',
timestamp: '' // 新增时间戳变量
}
},
onLoad(options) {
if(!options.uuid) {
uni.navigateBack()
}
this.uuid = options.uuid
this.modelId = options.modelId || ''
this.token = Fit.getLocalStorage('token')
this.sign = Fit.getLocalStorage('UUID')
this.timestamp = new Date().getTime() // 生成时间戳

// 构建URL时添加时间戳参数  
this.Src += "?uuid="+this.uuid + "&modelId=" + this.modelId + "&token=" + this.token +"&sign=" + this.sign +"&ip=" + this.$ip + "&timestamp=" + this.timestamp  

},
onReady() {
// 延迟显示web-view确保数据准备好
setTimeout(() => {
this.showWebview = true
}, 100)
},
onShow() {

setTimeout(() => {  
  this.showWebview = true  
}, 100)  

},
onUnload() {
// 销毁web-view
this.showWebview = false
},
methods: {

}
}
</script>

2025-06-16 17:46 负责人:无 分享
已邀请:

要回复问题请先登录注册