jsy-app/pages/common/webview/index.vue
2025-02-07 16:16:29 +08:00

50 lines
1.1 KiB
Vue

<template>
<custom-nav-bar :left="true" :title="params.title" />
<view v-if="params.url">
<web-view style="margin-top: 45px;" :webview-styles="webviewStyles" :src="`${params.url}`"></web-view>
</view>
</template>
<script>
var wv; //计划创建的webvie
export default {
data() {
return {
params: {},
webviewStyles: {
progress: {
color: "#FF3333"
}
}
}
},
props: {
src: {
type: [String],
default: null
}
},
onLoad(event) {
this.params = event
// if (event.title) {
// uni.setNavigationBarTitle({
// title: event.title
// })
// }
},
onReady() {
uni.showLoading()
// #ifdef APP-PLUS
//此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
var currentWebview = this.$scope.$getAppWebview()
setTimeout(function() {
wv = currentWebview.children()[0]
wv.setStyle({
top: 70
})
uni.hideLoading()
}, 500); //如果是页面初始化调用时,需要延时一下
// #endif
}
}
</script>