当前位置:网站首页>Uniapp wechat applet calls mobile map to navigate to the target point
Uniapp wechat applet calls mobile map to navigate to the target point
2022-06-24 18:13:00 【Gongsun yuaner】
If your page has obtained the user's location permission , That's how it's written
toAddress(position,positionAddress){
let arr = position.split(',')
const latitude = arr[0]
const longitude = arr[1]
console.log(' Call up the map :',arr)
// Open the map and navigate to the location
uni.openLocation({
latitude: parseFloat(latitude),
longitude: parseFloat(longitude),
scale: 15,
name: ' Destination ',
address: positionAddress,
success: res => {
console.log(' Map opened successfully :', res)
},
fail: res => {
console.log(' Failed to open map :', res)
},
})
},
If not , It should be :
uni.getLocation({
type: 'gcj02', // Return can be used for uni.openLocation Longitude and latitude of
success: function (res) {
const latitude = res.latitude;
const longitude = res.longitude;
uni.openLocation({
latitude: latitude,
longitude: longitude,
success: function () {
console.log('success');
}
});
}
});
边栏推荐
- Can the money invested in financial products be withdrawn at any time?
- Regression testing strategy for comprehensive quality assurance system
- How to use SEO to increase the inquiry volume?
- Four security issues of low code and no code development
- The 'ng' entry cannot be recognized as the name of a cmdlet, function, script file, or runnable program. Check the spelling of the name. If you include a path, make sure the path is correct, and then
- How can programmers reduce bugs in development?
- Leveldb source code analysis -- version management
- Failure analysis | database failure MHA is not switched
- The country has made a move! Launch network security review on HowNet
- Several key points for enterprises to pay attention to digital transformation
猜你喜欢
How can programmers reduce bugs in development?
Why are more and more people studying for doctors? Isn't it more and more difficult to graduate a doctor?
An analysis of the comments on the TV series Douban by procedural apes
Recommend 14 commonly used test development tools
[North Asia data recovery]_ mdb_ catalog. Mongodb database data recovery case in case of WT file corruption
Skills of writing test cases efficiently
Mcu-08 interrupt system and external interrupt application
LC 300. Longest increasing subsequence
How do yaml files and zmail collide with the spark of the framework, and how can code and data be separated gracefully?
Software testing methods: a short guide to quality assurance (QA) models
随机推荐
Using flex to implement common layouts
Business based precipitation component = & gt; manage-table
How to decompile APK files
How to use SEO to increase the inquiry volume?
Litamin: SLAM Based on geometric approximation of normal distribution
PHP WMI get hostname
Considerations for it project demand analysis
About whether arm's large and small end mode is related to CPU or compiler
Welcome to the network security threat information sharing program
Issue 39: MySQL time class partition write SQL considerations
Digital transformation informatization data planning and technology planning
[North Asia data recovery]_ mdb_ catalog. Mongodb database data recovery case in case of WT file corruption
投资理财产品的钱能随时取出来吗?
Specification for self test requirements of program developers
C language | printf output function
Easygbs video platform TCP active mode streaming exception repair
An analysis of the comments on the TV series Douban by procedural apes
基于BGP实现纯三层容器网络方案
Etching process flow for PCB fabrication
Business leaders compete for CIO roles