MonikaChen
MonikaChen
  • 发布:2021-01-25 14:29
  • 更新:2021-03-03 08:49
  • 阅读:915

【付费¥200请教】subNVue如何覆盖在plus.webview上面

分类:uni-app

我是社区钻石赞助者,以赞助者的信用保证,解决此问题,私信转账¥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>
2021-01-25 14:29 负责人:无 分享
已邀请:
DCloud_Android_ST

DCloud_Android_ST

可以提供下完整示例 我们看下

  • 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

DCMarvel

DCMarvel

不知道解決沒有 3.1+ 使用webview + subnvue 沒问题
试试不要show 用append
this.$scope.$getAppWebview().append(wv);

  • MonikaChen (作者)

    楼上官方说:“通过plus创建webview肯定是不行的”

    2021-03-02 23:34

  • DCMarvel

    回复 MonikaChen: 我的miui 11 和 ios 12, vue页面plus创建的webview ,使用subnvue展示菜单,没问题啊

    2021-03-03 08:46

  • DCMarvel

    回复 MonikaChen: 使用plus.webview 没必要使用nvue页面了,改vue页面即可

    2021-03-03 08:51

  • MonikaChen (作者)

    回复 DCMarvel: 我去,.vue里竟然可行??项目一开始就用.nvue,为的是打开App时提高加载速度。。

    2021-03-03 14:57

  • DCMarvel

    回复 MonikaChen: 嗯,部分页面还要是vue才行

    2021-03-03 15:42

DCMarvel

该问题目前已经被锁定, 无法添加新回复