最近查看我發布的小程序出了問題,沒有顯示天氣,打開文件查看,出現如下提示
那么如何解決呢
在 app.json 里面增加 permission 屬性配置
然后在app.json中
添加代碼
整個app.json:
"permission": { "scope.userLocation": { "desc": "你的位置信息將用於小程序位置接口的效果展示" } }
應該是小程序更新過之后需要用戶自己允許是否獲取地址
{ "pages": [ "pages/index/index", "pages/home/home", "pages/logs/logs", "pages/test/test" ], "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#405f80", "navigationBarTitleText": "這是標題", "navigationBarTextStyle": "black", "enablePullDownRefresh ": "true" }, "tabBar": { "borderStyle": "white", "position": "bottom", "list": [ { "pagePath": "pages/home/home", "text": "首頁", "iconPath": "images/tab/paidui.png", "selectedIconPath": "images/tab/paidui1.png" }, { "pagePath": "pages/test/test", "text": "記錄", "iconPath": "images/tab/jilu.png", "selectedIconPath": "images/tab/jilu2.png" } ] }, "permission": { "scope.userLocation": { "desc": "你的位置信息將用於小程序位置接口的效果展示" } } }