How to realize Map underlining by WeChat Mini Programs
This article will explain in detail how WeChat Mini Programs realizes map marking. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
WeChat Mini Programs map underlining is a very basic function of Mini Program, so how to achieve Mini Program map underlining?
Var point = [] var that2function drawline () {that2.setData ({polyline: [{points: point, color: "# 99FF00", width: 4, dottedLine: false}],})} / / get latitude and longitude function getlocation () {var latitude1, longitude1 wx.getLocation ({type: 'gcj02') Success: function (res) {latitude1 = res.latitude longitude1 = res.longitude point.push ({latitude:latitude1, longitude:longitude1}) console.log (point)})} Page ({data: {polyline: []}, onReady: function () {that2 = this wx.getLocation ({type: 'gcj02') Success: function (res) {that2.setData ({long: res.longitude, lat: res.latitude})})}, start:function () {this.timer=setInterval (repeat, 10000) Function repeat () {console.log ("re") getlocation () drawline ()}, end: function () {console.log ("clear") clearInterval (this.timer)})
This is the end of the article on "how to achieve Map marking by WeChat Mini Programs". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.