小程序使用腾讯位置插件获取当前位置

1.小程序后台

设置-第三方设置-插件管理-添加插件

2.进入网站

腾讯位置服务
设置对应的额度

mapPickerPlugin(res) {
			const key = ""; //使用在腾讯位置服务申请的key
			const referer = "铅锂运营"; //调用插件的app的名称
			const category = "生活服务,娱乐休闲";
			uni.navigateTo({
				url:
					"plugin://chooseLocation/index?key=" +
					key +
					"&referer=" +
					referer +
					"&category=" +
					category,
			});
		},
onUnload() {
		// 页面卸载时设置插件选点数据为null,防止再次进入页面,geLocation返回的是上次选点结果
		chooseLocation.setLocation(null);
	},
onShow() {
		const location = chooseLocation.getLocation(); // 如果点击确认选点按钮,则返回选点结果对象,否则返回null
		if (location) {
			this.latitude = location.latitude;
			this.longitude = location.longitude;
		}
	},

你可能感兴趣的:(小程序,数据库)