Home >Web Front-end >uni-app >Use uniapp to develop a simple map navigation
How to use uniapp to develop a simple map navigation? This article will provide you with an idea for making a simple map. I hope it will be helpful to you!
Let’s take a look at the renderings first
Required configuration
needs to be inapp module in
manifest.json Configure the map and add the
key of the relevant map. If not, you can apply on the relevant developer platform
Map marker points
To create marker points in uniapp map, you need to use an attributemarkers .
markers
Description | Type | Required | |
---|---|---|---|
Mark point id | number | true | |
latitude | number | true | |
Longitude | number | true | ##iconPath |
string | false | callout | |
Object | false | label | |
Object | false |
https://uniapp.dcloud.io/component/map.htmlThe attribute creates marker points.After understanding these, we can use
markers
markersThe attribute is of array type, so marker points should be created like this
this.covers = [ { id: 1, latitude: 34.7486, longitude: 113.6709, iconPath: '../../static/shop.png', title: "目的地" } ];
If you want to add more marker points, you can continue to add them in the array.
object, Each
object
mount
<map :markers="covers"></map>
Coordinate connectionIf we want to connect our coordinates, we need to use the polyline
attribute. Let’s take a look at the common attributes of
polyline
Type | Required | ##points | |
---|---|---|---|
true | color | The color of the line | |
false | width | Line width | |
false | iconPath | Displayed icon | |
false | arrowLine | Line with arrow | |
false | colorList | Rainbow display | |
false |
The above is the detailed content of Use uniapp to develop a simple map navigation. For more information, please follow other related articles on the PHP Chinese website!