8***@qq.com
8***@qq.com
  • 发布:2019-06-06 15:22
  • 更新:2020-10-22 10:45
  • 阅读:9852

uni-app动态修改导航栏的buttons 的text?

分类:uni-app

刚进入点击编辑可改成完成,再点完成就报错了,
https://ask.dcloud.net.cn/question/71175 这个链接我看的不是很懂,试了没弄出来,希望有具体的案例,非常感谢


    onNavigationBarButtonTap(e) {  
            console.log(e)  
            const index = e.index;  
            console.log(this)  
            console.log(this.$mp.page)  
            if (index === 0) {  
                if (e.text === "编辑") {  
                    var currentWebview = this.$mp.page.$getAppWebview();  
                    currentWebview.setTitleNViewButtonStyle(0, {  
                        text: "完成",  
                    });  
                    // this.titleNViewWebview()  
                    this.showChecked = true;  
                } else {  
                    var currentWebview = this.$mp.page.$getAppWebview();  
                    currentWebview.setTitleNViewButtonStyle(0, {  
                        text: "编辑",  
                    });  
                    // this.titleNViewWebview()  
                    this.showChecked = false;  

                }  

            }  
        },  
报错  

[Vue warn]: Property or method "toJSON" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.  
15:10:46.897 (found in pages/my/family)
2019-06-06 15:22 负责人:无 分享
已邀请:
8***@qq.com

8***@qq.com (作者) - 90后IT

https://www.cnblogs.com/Yong0921/p/10672092.html

MonikaChen

MonikaChen

this.$mp.page.$getAppWebview is not a function

ggui

ggui

这个方法H5不能用,只能给app用,所以你需要加一个条件编译

  • j***@163.com

    请问是怎样的条件编译?

    2021-06-02 10:20

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