当前位置:网站首页>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');
}
});
}
});
边栏推荐
- Three years of bug free, tips for improving code quality
- Bigdecimalavoiddoubleconstructorrule: do not directly use the double variable as a parameter to construct BigDecimal
- Yum to install warning:xxx: header V3 dsa/sha1 signature, key ID 5072e1f5: nokey
- Leveldb source code analysis -- version management
- 布隆过滤器综述文章论文阅读:Optimizing Bloom Filter: Challenges, Solutions, and Comparisons
- Regression testing strategy for comprehensive quality assurance system
- Issue 39: MySQL time class partition write SQL considerations
- Business leaders compete for CIO roles
- Use py-mysql2pgsql to synchronize MySQL data to Greenplum
- What are the reasons for the abnormal playback of the online channel of the channel accessed by easycvr national standard protocol?
猜你喜欢

Business leaders compete for CIO roles

How can an enterprise successfully complete cloud migration?

Several key points for enterprises to pay attention to digital transformation

Two micro service interviews where small companies suffer losses

Ten software development indicators for project managers

Ten excellent business process automation tools for small businesses

国家出手了!对知网启动网络安全审查

Top ten popular codeless testing tools

Project Management Guide: tips, strategies and specific practices
Online sequence flow chart making tool
随机推荐
Do you know CMDB?
Two micro service interviews where small companies suffer losses
Yum to install warning:xxx: header V3 dsa/sha1 signature, key ID 5072e1f5: nokey
这个巡检平台你还不知道,真是亏大了!
Mcu-08 interrupt system and external interrupt application
Php7.4.28 installing the pcntl extension
Nine practical guidelines for improving responsive design testing
Solutions for RTSP video streaming played by several browsers
TCE入围2020年工信部信创典型解决方案
A set of IM architecture technology dry goods for 100 million users (Part 2): reliability, orderliness, weak network optimization, etc
Cloud MySQL importing cloud data warehouse PostgreSQL best practices
Do you charge for PDF merging software? Programmers make one by themselves
Conditional competition overview
congratulate! The first dragon lizard community annual outstanding contribution award is announced. Check it now
Operation and maintenance guide | cos back source setting practice
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
Explanation of pod DNS configuration & cases of DNS resolution failure
Eight recommended microservice testing tools
你知道CMDB吗?
Litamin: SLAM Based on geometric approximation of normal distribution