1. Rendering2. Operation steps1. Apply for Tencent Map key——Address 2. Add Tencent plug-in to the mini program background - development document 3. Mini Program Code app.json Settings let plugin = requirePlugin('routePlan'); let key = ''; //Use the key applied for in Tencent location service let referer = ''; //The name of the app that calls the plugin let endPoint = JSON.stringify({ //End point 'name': 'Yoshinoya (Beijing West Railway Station North Exit)', 'latitude': 39.89631551, 'longitude': 116.323459711 }); wx.navigateTo({ url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint }); Or you can also use the built-in map navigation of the applet Use the applet built-in map wx.getLocation and wx.openLocationOfficial website link //wxml <button type="default" bindtap="openMap">Open map</button> //js Page({ data: { }, openMap: function () { wx.getLocation({ type: 'gcj02', // default is wgs84 returns gps coordinates, gcj02 returns coordinates that can be used for wx.openLocation success: function (res) { // success console.log(res.latitude); console.log(res.longitude); wx.openLocation({ latitude: res.latitude, // Latitude, range is -90~90, negative number indicates south latitude longitude: res.longitude, // Longitude, range is -180~180, negative number indicates west longitude scale: 28, // Scaling ratio name:"Name of the place to be found (such and such restaurant)", address: "Address: Detailed description of the place to go" }) } }) } }) SummarizeThis is the end of this article about how to implement navigation in WeChat Mini Programs. For more information about the navigation function in WeChat Mini Programs, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL database master-slave configuration tutorial under Windows
>>: Example of configuring multiple SSL certificates for a single Nginx IP address
Table of contents 1. The concept of filter 1. Cus...
Table of contents Kill instruction execution prin...
<br />This tag can display a horizontal line...
Before starting the main text, I will introduce s...
Record some of the places where you spent time on...
Hi, everyone; today is Double 12, have you done a...
Sometimes we may need to operate servers in batch...
Table of contents 1. Registering custom instructi...
question First, let me talk about the problem I e...
mysql accidentally deleted data Using the delete ...
First, let me explain the application method. The...
The table caption can be placed above or below th...
Get ip tool import lombok.extern.slf4j.Slf4j; imp...
Using Javascript to implement countdown to close ...
CSS CodeCopy content to clipboard .bottomTable{ b...