当前位置:网站首页>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 time
Question 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!️️
边栏推荐
- hackmyvm-hopper预排
- Stable and easy-to-use short connection generation platform, supporting API batch generation
- (2) Sequence structures, Boolean values of objects, selection structures, loop structures, lists, dictionaries, tuples, sets
- Google Hacking
- Advanced Operations on Arrays
- Kali环境下Frida编写脚本智能提示
- (5) Modules and packages, encoding formats, file operations, directory operations
- 一个网络安全小白鼠的学习之路——nmap的基本使用
- Various ways of AES encryption
- 13. JS output content and syntax
猜你喜欢
随机推荐
The learning path of a network security mouse - the basic use of nmap
利用cookie获取admin权限 CTF基础题
web安全之目录遍历
(2) 顺序结构、对象的布尔值、选择结构、循环结构、列表、字典、元组、集合
C language uses stack to calculate infix expressions
一个网络安全小白鼠的学习之路—nmap高级用法之脚本使用
DVWA靶机安装教程
Xiaoyao multi-open emulator ADB driver connection
Solve the problem of Zlibrary stuck/can't find the domain name/reached the limit, the latest address of Zlibrary
Pycharm packages the project as an exe file
GreenOptic: 1 vulnhub walkthrough
2. PHP variables, output, EOF, conditional statements
hackmyvm: juggling walkthrough
php函数漏洞总结
[mikehaertl/php-shellcommand] A library for invoking external command operations
Scrapy crawler encounters redirection 301/302 problem solution
ES6 array extension methods map, filter, reduce, fill and array traversal for…in for…of arr.forEach
一次代码审计的笔记(CVE-2018-12613 phpmyadmin文件包含漏洞)
(1) introduction to Thinkphp6, installation view, template rendering, variable assignment
After the mailbox of the Pagoda Post Office is successfully set up, it can be sent but not received.