uni-app拒絕授權后再次授權


getLocation(){
				uni.getLocation({
				    type: 'wgs84',
				    success: function (res) {
				        console.log('當前位置的經度:' + res.longitude);
				        console.log('當前位置的緯度:' + res.latitude);
				    },
					fail(){
						uni.showModal({
							content: '檢測到您沒打開獲取位置功能權限,是否去設置打開?',
							confirmText: "確認",
							cancelText: '取消',
							success: (res) => {
								if (res.confirm) {
									uni.openSetting({
										success: (res) => {
											uni.showToast({
												title: '授權后請重新打開此頁面',
												icon: 'none',
												success:function(){
													
												}
											})
										},
										fail: (err) => {
											console.log(err)
										}
									})
								} else {
									uni.showToast({
										title: '獲取地理位置授權失敗',
										icon: 'none',
										success:function() {
											
										}
									})
								}
							}
						})
					}
					
				});
			},

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM