uni.getLocation(OBJECT) | uni-app官网

wx.getSetting({
				success: (res) => {
					if (!res.authSetting['scope.userLocation']) {
						wx.authorize({
							scope: 'scope.userLocation',
							success: (res) => {

							},
							fail: (res) => {
								wx.showModal({
									title: '提示',
									content: '位置信息未授权,点击确定前往授权',
									success: function (res) {
										if (res.confirm) {
											wx.openSetting({
												success: (res) => {
													console.log('授权成功')
												}
											})
										}
									}
								})
							}
						})
					} else {
						uni.getLocation({
							type: "gcj02",
							success: (res) => {
								let latitude = res.latitude
								let longitude = res.longitude
								uni.chooseLocation({
									latitude,
									longitude,
									success: (result) => {
										// result.name  位置名称
                                        // result.address  详细地址
									}
								})
							}
						})
					}
				}
})

1

09-16 09:02