当前位置:网站首页>uniapp | Problems with the use of the official map component
uniapp | Problems with the use of the official map component
2022-08-02 04:02:00 【dumb papa】
1. Selection of map SDK
Before using uniapp to develop map functions, bloggers used Baidu Maps SDK to develop web map functions.In the initial development, I hope to be able to use the SDK of Baidu Maps, but there is a big difference between uniapp and web-side development when accessing the map function. Uniapp provides a map component
Note: When debugging on the real machine, the
2, different page file selection
When using uniapp for APP development, you can choose the vue page (suffixed with .vue) and the nvue page (suffixed with .nvue). The difference between the
Recommended to read carefully: Uniapp's map component introduction
Use vue page development (there is a hierarchy problem)
If you want to add other content to the map component: you can use the marker, control in the map component and the
Note: The
Use nvue page development (no hierarchy problem)
To use nvue page, you need to configure nvue page and vue page in pages.json, there is no hierarchy problem in nvue page, you can nest tags at will in the map component, but the nvue page refers to the weex framework, which only supports flex layout in layout, does not support adding shadows, and supports limited tags and CSS. does not support CSS such as SCSSProcessorCorrect here, nvue page supports scss
Recommended to read carefully: Uniapp's nvue framework tutorial
3. Summary of common problems in development
Question 1: The map does not display after the app is packaged?
The map does not display after the app is packaged. It may be that the map component is not checked in the manifest.json and the secret key of the AutoNavi map or Baidu map is configured. In this case, the map area will be displayed in white after the page containing the map is opened..
Question 2: Markers are not displayed after adding the map component?
In this case, we usually need to obtain the positioning point information from the backend, and dynamically display the positioning as markers on the map. At this time, the array bound by markers is dynamically changed. After changing the array bound by markers,The array bound to markers needs to be reassigned, for example:
markers=[{latitude: Obtained latitude,longitude: Obtained longitude,}]//Reassign markers each timeQuestion 3: The marker on Android is displayed normally, but the marker on ios cannot be displayed?
This situation may be caused by markers not configuring the id attribute when they are used (pro-test). It is recommended to refer to the usage in Uniapp's hello-uniapp when using it.
Question 4: The use of the relevant JS API of the map component is invalid?
In this case, the map object is obtained through uni.createMapContext, but the use of the related API is invalid.The page we use map must be configured in pages.json, and the page that can be used for routing jumps, otherwise the use of the relevant JS API will be invalid. When the blogger encounters this problem, he uses the relevant subNvue page.JS API.
️️The blogger is also a novice who uses uniapp to develop. If there is something wrong, thank you for correcting!️️
边栏推荐
- CTF-Neting Cup Past Topics
- 一个网络安全小白鼠的学习之路—nmap高级用法之脚本使用
- 敏感信息泄露
- PHP入门(自学笔记)
- GreenOptic: 1 vulnhub walkthrough
- hackmyvm: may walkthrough
- hackmyvm: may walkthrough
- [league/climate] A robust command-line function manipulation library
- ES6 three-dot operator, array method, string extension method
- VIKINGS: 1 vulnhub walkthrough
猜你喜欢

VIKINGS: 1 vulnhub walkthrough

CTF之xxe

DVWA drone installation tutorial

C language uses stack to calculate infix expressions

(5) Modules and packages, encoding formats, file operations, directory operations

(1) introduction to Thinkphp6, installation view, template rendering, variable assignment

hackmyvm-hopper预排

(3) Thinkphp6 database

利用cookie获取admin权限 CTF基础题

Alfa: 1 vulnhub walkthrough
随机推荐
14. JS Statements and Comments, Variables and Data Types
12. What is JS
The focus of the Dom implementation input triggers
hackmyvm: may walkthrough
Eric靶机渗透测试通关全教程
PHP deserialization vulnerability
(3)Thinkphp6数据库
Alibaba Cloud MySQL 5.7 installation and some major problems (total)
Advanced Operations on Arrays
(8) requests, os, sys, re, _thread
Basic use of v-on, parameter passing, modifiers
[league/flysystem] An elegant and highly supported file operation interface
The shooting range that web penetration must play - DVWA shooting range 1 (centos8.2+phpstudy installation environment)
GreenOptic: 1 vulnhub walkthrough
Using PHPMailer send mail
hackmyvm: may walkthrough
Offensive and defensive world - novice MISC area 1-12
【无标题】
Shuriken: 1 vulnhub walkthrough
Phpstudy安装Thinkphp6(问题+解决)