Details about map instances of the applet map
Details about map instances of applets
Wxml:
Class = "button" bindtap = "getlocation" style = "margin-top: 30px "markers =" {markers} "> locate longpolling =" {longpolling} "latitude =" {latitude} "markers =" {markers }}" covers = "{covers}" style = "width: 100%; height: 300px; margin-top: 30px ">
Js:
// Obtain the var app = getApp () Page ({data: {latitude: 0, // latitude: 0, // longitude speed: 0, // speed accuracy: 16, // location accuracy markers: [], covers: [],}, onLoad: function () {}, getlocation: function () {var markers = [{latitude: 28.211400, longlinks: 112.914250, name: 'xidi mansion ', desc: 'My location'}] var covers = [{latitude: 28.211400, longlinks: 112.914250, iconPath: '/image/ic_position.png', rotate: 0}] this. setData ({longpolling: 112.914250, latitude: 28.211400, markers: markers, covers: covers,}) wx. getLocation ({type: 'gcj02', success: function (res) {var latitude = res. latitudevar longpolling = res. longitudevar speed = res. speedvar accuracy = res. accuracyconsole. log ("latitude:" + latitude) console. log ("longpolling:" + longpolling) console. log ("speed:" + speed) console. log ("accuracy:" + accuracy) wx. openLocation ({latitude: latitude, longpolling: longpolling, scale: 28 })}})}})
:
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!