90后菜鸟
90后菜鸟
  • 发布:2019-05-18 11:53
  • 更新:2019-06-27 10:31
  • 阅读:2975

app怎么把获取到的位置信息放到导航栏左侧

分类:uni-app
{  
            "path": "pages/index/index2",  
            "style": {  
                "navigationBarTitleText": "demo",  
                "enablePullDownRefresh": true,  
                "app-plus":{  
                    "titleNView": {  
                        "buttons": [ //原生标题栏按钮配置,  
                            {  
                                "type":"none",  
                                            "text": "位置",  
                                "fontSize": "17",  
                                "float":"left",  
                                "width": "70",  
                                "select": "true"  
                            },  
                            {  
                                "type":"none",  
                                "float": "right",  
                                "fontSrc":"/static/iconfont.ttf",  
                                "text": "\ue69a"  
                            }  
                        ]  
                    }  
                }  
            }  
        },
2019-05-18 11:53 负责人:无 分享
已邀请:
90后菜鸟

90后菜鸟 (作者) - 90后

// #ifdef APP-PLUS  
        let pages =  getCurrentPages()  
        let page = pages[pages.length - 1]  
        let currentWebview = page.$getAppWebview()  
        let titleObj = currentWebview.getStyle().titleNView  
        // this.addressName 位置  
        titleObj.buttons[0].text = this.addressName  
        currentWebview.setStyle({  
            titleNView:titleObj  
        })  
        // #endif

ok了,问题已经解决了

  • loquy

    $getAppWebview is not a function

    2019-06-15 12:04

语文数学天才

语文数学天才 - 做最顺手的nvue组件库与工具集

很好!刚好有需要。谢谢!

90后菜鸟

90后菜鸟 (作者) - 90后

getRegeo() {  
            this.amapPlugin.getRegeo({  
                success: res => {  
                    this.addressName = res[0].regeocodeData.addressComponent.district;  
                    console.log(this.addressName);  
                    // #ifdef APP-PLUS  
                    let pages = getCurrentPages();  
                    let page = pages[pages.length - 1];  
                    let currentWebview = page.$getAppWebview();  
                    let titleObj = currentWebview.getStyle().titleNView;  
                    // this.addressName 位置  
                    titleObj.buttons[0].text = this.addressName;  
                    currentWebview.setStyle({  
                        titleNView: titleObj  
                    });  
                    // #endif  
                }  
            });  
        },
90后菜鸟

90后菜鸟 (作者) - 90后

https://ask.dcloud.net.cn/article/35374

  • 1***@126.com

    你好, h5端会报page.$getAppWebview is not a function, 这个如何处理

    2019-10-21 15:06

  • d***@163.com

    回复 1***@126.com: 你怎么解决这个问题的 我也遇到了

    2019-11-19 17:13

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