NPM install qqmap-wx-jSSDK –save 2. Go to the official website to download a JS file SDK package
Var QQMapWX = require('qqmap-wx-jssdk') var qqmapsdk = new QQMapWX({// 'xxxxxxxxxxxxxxxxxxxxxxxx' }) //html <map style="width: 100%; min-height: 100vh;" :scale = 'scale' :latitude="latitude" :longitude="longitude" :markers="markers" show-compass="true" Enable-3d ="true"></map> data(){return{latitude: 23.0516513, longitude: 113.3903287, scale: 15, markers:[]}} // Methods :{nearby_search(key) {var that = this; //var xmwzB_index = that.xmwzB_index; //var list_c = that.arrlist[that.xmwzB_index]; // Check whether the request is made, if not, request; //if(list_c.length){// that. Arrlist_cur = list_c //}else{wx.showtoast ({title: 'please wait ', icon: 'loading', duration: 2000}) qqmapsdk.search({keyword: key, // search keywords page_size: 5, // a page to display several location: This.latitude + ',' + that.longitude, // set the longitude for the search. Success: function (res) { var arrlist = []; // Some may involve location jumps (latitude and longitude are required); Arrlist. push({latitude: that.latitude, longitude: that.longitude, // mark iconPath: '', }) for (var i = 0; i < res.data.length; I ++) {arrlist.push({// get the result and put it into the MKS array latitude: res.data[I].location.lat, longitude: Res.data [I].location. LNG, distance: res.data[I]._distance,// distance iconPath: "",// mark icon // mark image callout: { content:res.data[i].title, color: '#999', fontSize: 14, borderWidth: 2, borderRadius: 10, bgColor: '#fff', padding: 5, display: 'BYCLICK', textAlign: Var arrlist_key = 'arrList ['+xmwzB_index+']'; //var arrlist_key =' arrList ['+xmwzB_index+']'; // That. Arrlist_cur = arrList}, fail: function (res) {console.log(res); }, complete: function (res) { //console.log(res.data); }}); / /}}}Copy the code
Wish you all success in your work