当前位置:网站首页>Uniapp ---- detailed steps to obtain the longitude and latitude of the current position and other information (including applet)
Uniapp ---- detailed steps to obtain the longitude and latitude of the current position and other information (including applet)
2022-07-28 08:38:00 【In Heaven】
uniapp---- Detailed steps to obtain the longitude and latitude of the current position ( Contains applets )
1. Configure in the project , What I choose is Gaode map , Fill in relevant information .

2. Enter Gaode official website :https://lbs.amap.com/upgrade#quota, Log in and register , Enter into “ Console ”.
3. open “ Application management ” -> “ My application ” page , Click on “ Create new apps ”, Fill in the content according to the prompts on the page to create an application .
4. Under application, click “ add to ” Add... To the app Key, As needed, they are Android platform 、iOS Platform application Key.
5. You also need to apply for a wechat applet key, Because my project is to develop small programs first , stay uniapp There are detailed descriptions in the official documents of :
Reference link :https://ask.dcloud.net.cn/article/35070 The steps of reference link are very detailed, and you can write the project directly .
import amap from '../../common/amap-wx.js';
export default {
data() {
return {
amapPlugin: null,
key: ' Gao de key',
addressName: '',
weather: {
hasData: false,
data: []
}
}
},
onLoad() {
this.amapPlugin = new amap.AMapWX({
key: this.key
});
},
methods: {
getRegeo() {
uni.showLoading({
title: ' Getting information '
});
this.amapPlugin.getRegeo({
success: (data) => {
console.log(data)
this.addressName = data[0].name;
uni.hideLoading();
}
});
}
}
}
6. When uniapp When the wechat developer tool is opened , You need to configure map related codes :
// Development process , Need to be in unpackage>>dist>>dev>>mp-weixin>>app.json Add the following configuration to
"permission": {
"scope.userLocation": {
"desc": " Your location information will be used to show the effect of the applet location interface "
}
}
// stay manifest.json Configure... In the source view of : To configure appid And geographical location
"mp-weixin": {
/* Applet specific relevance */
"appid": "", // Need configuration appid
"setting": {
"urlCheck": false
},
"usingComponents": true,
"permission": {
"scope.userLocation": {
"desc": " Your location information will be used to show the effect of the applet location interface "
}
}
}

边栏推荐
- [pyqt] pyqt development experience_ How to find events and methods of controls
- 五张图看懂EMI电磁干扰的传播过程-方波陡峭程度对高频成分的影响,时序到频域频谱图形,波形形状对EMI辐射的影响。
- Puzzle (004.3) pattern puzzle
- 49-OpenCv深入分析轮廓
- Prescan quick start to proficient in lecture 17, speed curve editor
- js卡通英文字母打字小游戏源码
- EMC EMI磁珠的特性
- postgresql查询【表字段类型】和库中【所有序列】
- Redis 基本知识,快来回顾一下
- tkMapper的使用-超详细
猜你喜欢
随机推荐
2021-07-02
classLoader加载的class的回收
[book club issue 13] Chapter 1 multimedia processing tools ffmpeg tools
js糖果消消乐小游戏源码
阿里巴巴内部面试资料
Analysis of model predictive control (MPC) (IX): numerical solution of quadratic programming (II)
How to set it to pop up the right-click menu
New generation cloud native message queue (II)
模型预测控制(MPC)解析(九):二次规划的数值解(下)
学术界爆火的类脑智能,啥时候能落地?来听行业大咖怎么说丨量子位·对撞派 x 时识科技...
leetcode/排序数组中两个数字之和
bash-shell 免交互
Get the clicked line number in qtablewidget
MySQL how to add users and set permissions?
[pyqt] pyqt development experience_ How to find events and methods of controls
五张图看懂EMI电磁干扰的传播过程-方波陡峭程度对高频成分的影响,时序到频域频谱图形,波形形状对EMI辐射的影响。
SQL function
Regular expression for mobile number verification
MySQL怎么查询可以同时判断多个字段值是否存在
Window 1 - > main window of the application (27)









