uniapp h5 app 在web-view 上层加一个按钮
vue界面web-view无法调节,所以用nvue,nvue不支持百分比,且必须给web-view设置宽高
适用于静态外链,游戏不好用嗯
这破玩意可以用iframe代替喷香,即可以调节大小又可以在上层加东西,
如果仅仅是h5的话可以用cover-view,postision:fixed,层级越大越好(这个方法不需要nvue)
<template>
<view>
<web-view :style="{ height: pageHeight + 'px' }" :src="url" class="web"></web-view>
<view class="ce" @click="back">
<text>ce</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pageHeight: '',
code: '',
url: '',
}
},
onLoad(options) {
getApp().$api.userInfo({}, res => {
if (res.status) {
this.code = res.data.kill_id
this.url = 'https://game.laopaowenchuang.com/index.html?code=' + this.code
console.log(this.url, '============')
}
})
},
mounted() {
let getWindowInfo = uni.getWindowInfo()
this.pageHeight = getWindowInfo.screenHeight
console.log(this.pageHeight); //屏幕高度
},
methods: {
back() {
uni.navigateBack({
delta: 1
})
},
}
}
</script>
<style lang="scss" scoped>
.ce {
position: absolute;
z-index: 99999;
top: 80rpx;
right: 150rpx;
background-color: cadetblue;
}
.web {
width: 750rpx;
// height: calc(pageHeight);
}
</style>