<template>
<view class="container">
<view class="main">
<web-view :src="src" class="webBox"></web-view>
</view>
<foot :current-page = "4" class="tabbar" v-if="footShow"></foot>
</view>
</template>
<script>
import footer from '../../component/footer.vue'
export default {
components:{
foot:footer
},
data() {
return {
src: 'https://www.720yun.com/vr/6ffjzzsukm0',
footShow:true,
screenHeight:''
}
},
mounted() {
this.$music.playBgm({mute:false})
},
onLaunch() {
uni.hideTabBar()
},
onShow() {
this.footShow = true
},
onHide() {
// this.footShow = false
},
async onReady(){
// #ifdef APP-PLUS
// this.getHight()
var currentWebview = this.$scope.$getAppWebview();
const query = uni.createSelectorQuery().in(this);
let topHeight = 0;
query.select('.header-top-bg').boundingClientRect((data) => {
topHeight = data.height; // 头部元素高度
}).exec();
console.log(this.appHight)
setTimeout(function() {
let hight = uni.getSystemInfoSync()
this.screenHeight = hight.screenHeight
console.log(this.screenHeight)
let mate = hight.screenHeight - 70
let wv = currentWebview.children()[0];
console.log(mate)
wv.setStyle({top:topHeight,height: mate})
}, 1000); //如果是页面初始化调用时,需要延时一下
// #endif
},
methods: {
}
}
</script>
<style scoped>
.container {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
background-color: #052d3d;
}
.main{
height: 95%;
width: 100%;
flex: 1;
}
.tabbar{
width: 100%;
height: 70px;
z-index: 9;
}
</style>
如附件控制web-view不遮挡自己写的tabber,方法真机测试有效,打包出来后就没有效
这写的啥 (作者)
但是我写一个固定数值就有用,
2024-05-09 18:30