当前位置:网站首页>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 "
}
}
}

边栏推荐
- 学术界爆火的类脑智能,啥时候能落地?来听行业大咖怎么说丨量子位·对撞派 x 时识科技...
- 2018年1月西邻雪山自驾游攻略
- 2022 Niuke multi school second problem solving Report
- jquey的基础语法
- GB/T 41479-2022信息安全技术 网络数据处理安全要求 导图概览
- Can‘t connect to server on ‘IP‘ (60)
- 2022牛客多校第二场解题报告
- JS cartoon English alphabet typing game source code
- feign 调用
- Sliding screen switching on uniapp supports video and image rotation, similar to Tiktok effect
猜你喜欢

C轮融资已完成!思迈特软件领跑国内BI生态赋能,产品、服务竿头一步

uniapp的swiper动态设置current值不生效解决办法

bash-shell 免交互

半桥BUCK电路—记录篇

单片机IO口控制12V电压通断,MOS和三极管电路

MCU IO port controls 12V voltage on and off, MOS and triode circuit

Js继承方法

Shell编程规范与变量

Matlab file path
![[Qt5] a method of multi window parameter transmission (using custom signal slot) and case code download](/img/6d/870add6179f0e3a2f9b719f79594f3.png)
[Qt5] a method of multi window parameter transmission (using custom signal slot) and case code download
随机推荐
Unity切换到另一个场景的时候,发现该场景变暗了
jquey的基础语法
CarSim simulation quick start (XII) - Driver Model (2)
bash-shell 免交互
The current value of uniapp's swiper dynamic setting does not take effect solution
leetcode/单词长度的最大乘积
Feign call
opengauss同步状态疑问
CarSim simulation quick start (XI) - Driver Model (1)
Creation of status bar (29)
Starfish Os打造的元宇宙生态,跟MetaBell的合作只是开始
模型预测控制(MPC)解析(九):二次规划的数值解(下)
EMC EMI磁珠的特性
学术界爆火的类脑智能,啥时候能落地?来听行业大咖怎么说丨量子位·对撞派 x 时识科技...
Prescan quick start to master the road elements of lecture 15
本人男,27岁技术经理,收入太高,心头慌得一比
postgresql查询【表字段类型】和库中【所有序列】
Three different numbers with 0 in leetcode/ array
Opencv+paddle Orc recognize pictures and extract table information
五张图看懂EMI电磁干扰的传播过程-方波陡峭程度对高频成分的影响,时序到频域频谱图形,波形形状对EMI辐射的影响。