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

What is ssh? How to use? What are the misunderstandings?

Table of contents Preface What is ssh What is ssh...

This article teaches you how to play with CSS border

Border Style The border-style property specifies ...

Modification of time zone problem of MySQL container in Docker

Preface When Ahhang was developing the Springboot...

Solution to 700% CPU usage of Linux process that cannot be killed

Table of contents 1. Problem Discovery 2. View de...

Several methods of implementing carousel images in JS

Carousel The main idea is: In the large container...

How to use mysql index merge

Index merging is an intelligent algorithm provide...

Ubuntu 18.04 MySQL 8.0 installation and configuration method graphic tutorial

This article shares the installation and configur...

How to use vs2019 for Linux remote development

Usually, there are two options when we develop Li...

Example of how to set WordPress pseudo-static in Nginx

Quoting Baidu's explanation of pseudo-static:...

Why I recommend Nginx as a backend server proxy (reason analysis)

1. Introduction Our real servers should not be di...

Vue page monitoring user preview time function implementation code

A recent business involves such a requirement tha...

Layui implements the login interface verification code

This article example shares the specific code of ...

18 killer JavaScript one-liners

Preface JavaScript continues to grow and prosper ...