Browse Source

设置定位权限

htc 1 month ago
parent
commit
bbe577f0c0
2 changed files with 11 additions and 1 deletions
  1. 5 1
      manifest.json
  2. 6 0
      pagesHome/index.vue

+ 5 - 1
manifest.json

@@ -114,7 +114,11 @@
         "optimization" : {
             "subPackages" : true
         },
-        "permission" : {}
+        "permission" : {
+            "scope.userLocation" : {
+                "desc" : "获取当前天气"
+            }
+        }
     },
     "mp-alipay" : {
         "usingComponents" : true

+ 6 - 0
pagesHome/index.vue

@@ -96,6 +96,12 @@
 				myAmapFun.getWeather({
 					success:res=>{
 						this.weatherInfo = res.liveData;
+					},
+					fail:err=>{
+						uni.showModal({
+							title:'天气',
+							content:JSON.stringify(err)
+						})
 					}
 				})
 			},