DCMarvel
DCMarvel
  • 发布:2020-04-10 09:23
  • 更新:2020-04-12 15:50
  • 阅读:421

HTML5+ plus.webview.show 的相关问题

分类:HTML5+

当使用plus.webview.show 和 plus.webview.hide 配合使用,显示隐藏页面时,导航栏按钮事件会发生错乱!

示例 :
首页A : 正常显示,A页面的导航栏按钮(如:菜单,share等) 正常触发事件.

A -> 使用 plus.webview.show 打开 -> B页面 , B页面的导航栏按钮(如:菜单,share等) 正常触发事件.

B->页面 plus.webview.hide 显示A页面,A页面的导航栏按钮(如:菜单,share等) 会触发B页面的事件.

2020-04-10 09:23 负责人:无 分享
已邀请:
x***@qq.com

x***@qq.com - 疑问?的小纳?

有截图或代码示例吗

DCMarvel

DCMarvel (作者)

看来不上代码不行!

A页面


<template>  
    <view>  
        <view >  
            <button type="primary" @tap="toPage">toB</button>  
        </view>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
            }  
        },  
        onNavigationBarButtonTap() {  
            uni.showToast({  
                title:'A'  
            })  
        },  
        onLoad() {  

        },  
        methods: {  
            toPage(){  
                const pages = getCurrentPages();  
                if (pages.length > 1) {  
                    plus.webview.show(pages[1].$getAppWebview().id,'none',0,() => {  
                        plus.webview.hide(pages[0].$getAppWebview().id)  
                    })  
                }  
                else {  

                    uni.navigateTo({  
                        url:'/pages/index/new_file'  
                    })  
                }  
            }  
        }  
    }  
</script>  

<style>  
</style>  

B页面


<template>  
    <view>  
        <view >  
            <button type="primary" @tap="toPage">toA</button>  
        </view>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
            }  
        },  
        onNavigationBarButtonTap() {  
            uni.showToast({  
                title:'B'  
            })  
        },  
        onLoad() {  

        },  
        methods: {  
            toPage(){  
                const pages = getCurrentPages();  
                if (pages.length > 1) {  
                    plus.webview.show(pages[0].$getAppWebview().id,'none',0,() => {  
                        plus.webview.hide(pages[1].$getAppWebview().id)  
                    })  
                }  
                else {  

                    uni.navigateTo({  
                        url:'/pages/index/new_file'  
                    })  
                }  
            }  
        }  
    }  
</script>  

<style>  
</style>  
  • DCloud_uniCloud_WYQ

    为什么要用这种写法,uni-app里面自行管理webview是不推荐的

    2020-04-13 20:58

  • DCMarvel (作者)

    回复 DCloud_uniCloud_WYQ: 哦,不推荐的啊.那算了,如果没问题,uni-app 可以用VUE 随意写tabbar . 模拟显示,隐藏.都写完了,结果测试按钮有问题.tabbar可以起飞! 哈哈

    2020-04-14 12:28

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