위챗 애플릿 맵 API 인터페이스 응용 프로그램: 현재 위치를 가져오고 주소에 따라 맵 내비게이션을 표시하며 위치를 선택합니다
1472 단어 wechat
1. 현재 위치 가져오기
map: function () {
wx.getLocation({
// wgs84, gcj02
// wgs84 gps ,gcj02 wx.openLocation
type: 'gcj02',
//
success: function (res) {
console.log(res) //
},
//
fail: function (err) {
console.log(" , ")
},
// ( 、 )
complete: function (info) {
console.log(" ")
},
})
},
2. 구체적인 주소에 따라 지도 내비게이션을 표시한다
1. 우선'좌표 픽업기'를 사용하여 구체적인 주소의 좌표를 얻으려면 텐센트 지도 픽업기 주소:https://lbs.qq.com/tool/getpoint/index.html
2, wxjs 코드:
map: function () {
// 23.179200,108.294870
wx.openLocation({
//
latitude: 23.179200,
longitude: 108.294870,
// 18, 5-18
scale: 18,
//
name: ' ',
//
address: ' 8 ',
//
success: function (res) {
},
//
fail: function (err) {
wx.showToast({
title: ' , ',
})
},
})
},
3. 위치 선택
map: function () {
//
var that = this;
wx.chooseLocation({
success: function (res) {
console.log(res);
// success
if (res.address != '') {
console.log(' :' + res.address);
}
},
fail: function () {
},
complete: function () {
}
})
},
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
위챗 Bot 개발 테스트 계정 설정위챗봇이 개발한 노트. 1. 테스트 계정 만들기 먼저 부터 테스트용 계정을 만들겠습니다.로그인을 클릭하면 QR코드가 나오기 때문에 수중에 있는 위챗의 QR Corder로 스캔합니다. 2. Webhook URL 설정 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.