Two ways to connect WeChat mini program to Tencent Maps

Two ways to connect WeChat mini program to Tencent Maps

I've been writing a WeChat applet recently and encountered some problems. I searched a lot on the Internet, but I didn't find the answer I wanted.

I just dealt with the problem of this map and summarized it here, hoping it can help everyone.

There are actually two ways to access Tencent Maps in WeChat Mini Programs. The first is to call Tencent's own map, and the second is to use the plug-in ma-route

1. Calling Tencent’s own map

The implementation results are as follows:

This is very simple and many people use it.

You only need to call two map APIs.

It’s the two above. Of course, when calling openLocation, you must first call getLocation for authorization

You need to configure the information in app.json as follows:

Write the following method on the page where you need to jump to the map:

Click

Can pop up Baidu Maps, Amap and other third-party software

The above is the first method.

2. The second method

First, find the WeChat applet

Add the plugin in the plugin manager

Directions:

First configure in the app.json file

Secondly, configure the main.json file in its directory

I wrote it based on mpvue, so it is slightly different from the development documentation

First, get the destination address from the page you are redirected to, and then get the current location coordinates through getLocation

The code is as follows:

The following is the second method: the effect picture after success

This concludes this article on two ways to connect WeChat mini-programs to Tencent Maps. For more information on connecting WeChat mini-programs to Tencent Maps, please search for 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:
  • WeChat applet Tencent map SDK obtains the current address for analysis
  • Solution to the display deviation problem of Tencent Map in WeChat Mini Program
  • WeChat applet converts Baidu map coordinates into Tencent map coordinates
  • WeChat applet + Tencent map development to achieve path planning and drawing
  • Detailed explanation and implementation steps of using Tencent Map SDK in WeChat Mini Program

<<:  Detailed steps for developing WeChat mini-programs using Typescript

>>:  Application example tutorial of key in Vue page rendering

Recommend

How to reduce the memory and CPU usage of web pages

<br />Some web pages may not look large but ...

Understanding the CSS transform-origin property

Preface I recently made a fireworks animation, wh...

How to install and modify the initial password of mysql5.7.18

For Centos installation of MySQL, please refer to...

Analysis of MySQL lock mechanism and usage

This article uses examples to illustrate the MySQ...

Vue3 gets the current routing address

Correct answer Using useRouter : // router path: ...

MySQL Interview Questions: How to Set Up Hash Indexes

In addition to B-Tree indexes, MySQL also provide...

Summary of relevant knowledge points of ajax in jQuery

Preface Students who learn JavaScript know that A...

Docker image compression and optimization operations

The reason why Docker is so popular nowadays is m...

Zabbix monitoring solution - the latest official version 4.4 [recommended]

Zabbix 2019/10/12 Chenxin refer to https://www.za...

Method of using MySQL system database for performance load diagnosis

A master once said that you should know the datab...

Detailed tutorial on installing phpMyAdmin on Ubuntu 18.04

We will install phpMyAdmin to work with Apache on...

How does JS understand data URLs?

Table of contents Overview Getting started with d...

Linux uses dual network card bond and screwdriver interface

What is bond NIC bond is a technology that is com...