当前位置:网站首页>Wechat applet distance and map
Wechat applet distance and map
2022-07-03 04:49:00 【Xiafei997】
js:
// Map
wx.request({
url: 'http://www.day.com/index.php/map',
method:"GET",
data:{list_id:id},
header:{
"token":token
},
success(res){
// console.log(res.data.data)
var latitude=res.data.data.latitude
var longitude=res.data.data.longitude
_this.setData({
latitude:latitude,
longitude:longitude
})
// console.log(latitude)
wx.getLocation({
type: 'wgs84',
success (res) {
// console.log(res)
var la=res.latitude
var lo=res.longitude
// console.log(la)
var s=_this.distance(latitude,longitude,la,lo)
_this.setData({s})
}
})
let map=res.data.data
// // Render data
_this.setData({map})
}
})
Jump to map page :
map(){
var latitude=this.data.latitude;
var longitude=this.data.longitude;
// console.log(latitude)
wx.redirectTo({
url: '/pages/map/map?latitude='+latitude+'&&longitude='+longitude,
})
},
Map :
data: {
markers:[]
},
/**
* Life cycle function -- Monitor page loading
*/
onLoad: function (options) {
// console.log(options.latitude)
var markers=[{
latitude:options.latitude,
longitude:options.longitude
}]
this.setData({markers})
},
page :
<map markers="{ {markers}}" latitude="{ {markers[0]['latitude']}}"
longitude="{ {markers[0]['longitude']}}"></map>
边栏推荐
- Symbol of array element product of leetcode simple problem
- Web security - CSRF (token)
- 论文阅读_ICD编码_MSMN
- M1 Pro install redis
- Concurrent operation memory interaction
- 【XSS绕过-防护策略】理解防护策略,更好的绕过
- Truncated sentences of leetcode simple questions
- Apache MPM model and ab stress test
- Prepare for 2022 and welcome the "golden three silver four". The "summary of Android intermediate and advanced interview questions in 2022" is fresh, so that your big factory interview can go smoothly
- Reptile exercise 02
猜你喜欢
2022 Shandong Province safety officer C certificate examination content and Shandong Province safety officer C certificate examination questions and analysis
2022 t elevator repair simulation examination question bank and t elevator repair simulation examination question bank
Human resource management system based on JSP
First + only! Alibaba cloud's real-time computing version of Flink passed the stability test of big data products of the Institute of ICT
Games101 Lesson 9 shading 3 Notes
[XSS bypass - protection strategy] understand the protection strategy and better bypass
Internationalization and localization, dark mode and dark mode in compose
带有注意力RPN和多关系检测器的小样本目标检测网络(提供源码和数据及下载)...
Analysis of proxy usage of ES6 new feature
Network security textual research recommendation
随机推荐
第十九届浙江省 I. Barbecue
Shell script Basics - basic grammar knowledge
SSM based campus part-time platform for College Students
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
2022 t elevator repair simulation examination question bank and t elevator repair simulation examination question bank
After reviewing MySQL for a month, I was stunned when the interviewer of Alibaba asked me
关于开学的准备与专业认知
General undergraduate college life pit avoidance Guide
雇佣收银员(差分约束)
LVS load balancing cluster of efficient multi-purpose cluster (NAT mode)
After job hopping at the end of the year, I interviewed more than 30 companies in two weeks and finally landed
《牛客刷verilog》Part II Verilog进阶挑战
Market status and development prospects of the global IOT active infrared sensor industry in 2022
STM32 reverse entry
Shell script -- condition judgment
MC Layer Target
Crazy scientist
Day 51 - tree problem
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
The current market situation and development prospect of the global gluten tolerance test kit industry in 2022