Home> Web Front-end> uni-app> body text

How to implement map interaction for sending location in mobile uni-app project

青灯夜游
Release: 2022-02-07 18:09:19
forward
3829 people have browsed it

How does the uni-app mobile terminal imitate WeChat to implement map interaction for sending locations? The following article will introduce to you how to implement map interaction. I hope it will be helpful to you!

How to implement map interaction for sending location in mobile uni-app project

The company's new project must have a built-in map, or the old map must be revised and a new map must be aligned with WeChat in terms of UI and interaction, and functionally fit the business need.

Actually, these are quite simple. The main trouble lies in the animation interaction below.

But first, let me regret my original point. I built it into the project according to the Tencent map tutorial, and the preview in the browser was normal. However, when debugging on the real machine, I found that it could not be done, and I planned to change it again. , write an html in the project, and then introduce it into the project throughwebview.

Okay, I hope readers can take this as a warning.

How to implement map interaction for sending location in mobile uni-app project

Let’s talk about the development of this interaction.

First version of trial and error

The first version is to useuni-appto obtain the width and height of the device. The map width fills the screen, and the content and list are different. Account for 50% of the height. When the expanded list is triggered, adjust the height proportion and add a transition effect through thetransitionattribute.

But the result of this is that when the height ratio is automatically adjusted, the height adjustment value itself is excessive, and the animation looks stuck.

To put it bluntly, it’s just one word, ugly.

ps: The following code is just a core concept, not a real executable code. It can be understood as a pseudo-code;