我是社区钻石赞助者,以赞助者的信用保证,解决此问题,私信转账¥200
以下是我的尝试,无论如何调整zindex都无法让subNVue覆盖在plus.webview上方,如果是bug,那就等官方解决,如果是我的代码问题,请指出解法或者示例代码。
pages.json
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationStyle": "custom",
"app-plus": {
"subNVues":[{
"id": "fab",
"path": "pages/index/subNVues/fab.nvue",
"style": {
"position": "absolute",
"width": "55px",
"height":"55px",
"zindex": 99,
"right":"30px",
"bottom":"100px",
"background": "#ff0000"
}
}]
}
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
}
index.nvue
<template>
<view>
</view>
</template>
<script>
export default {
onLoad() {
const sysInfo = uni.getSystemInfoSync()
const wv = plus.webview.create('https://www.baidu.com', 'id', {width: sysInfo.windowWidth, top:sysInfo.statusBarHeight, bottom:0, zindex:-1})
wv.show('fade-in')
}
}
</script>
MonikaChen (作者)
示例:https://vkceyugu.cdn.bspapp.com/VKCEYUGU-uni4934e7b/af2face0-5ede-11eb-bdc1-8bd33eb6adaa.zip
2021-01-25 15:27
DCloud_Android_ST
回复 MonikaChen: subNVues本身也绑定页面的,你通过plus创建webview肯定是不行的。如果只是单纯想开个HTML页面用web-view标签。不要通过plus创建webview。
2021-01-25 16:20
DCloud_Android_ST
回复 DCloud_Android_ST:
用nativeObj.View来代替fab试试看能不能符合你的需求
onLoad() {
const sysInfo = uni.getSystemInfoSync()
const wv = plus.webview.create('https://www.baidu.com', 'id', {width: sysInfo.windowWidth, top:sysInfo.statusBarHeight, bottom:0, zindex:-1})
wv.show('fade-in')
var view = new plus.nativeObj.View('test',{top:'400px',left:'200px',height:'44px',width:'100%'});
// 绘制图片
view.drawBitmap("../../static/logo.png", {width:'100%',height:'100%'}, {width:'44px',height:'44px'} );
view.addEventListener("click", function(e){
console.log("点击原生控件:"+JSON.stringify(e));
}, false);
wv.append(view);
}
2021-01-25 18:24
MonikaChen (作者)
回复 DCloud_Android_ST: 我需要拦截网页里的所有请求做进一步操作,所以需要plus.webview。web-view标签能做到这个吗?
nativeObj.View可以覆盖,但是后续的弹窗等界面,代码就复杂很多了。
2021-01-25 22:59