@wltech/hooks
Advanced tools
Comparing version 0.1.47 to 0.1.48
{ | ||
"name": "@wltech/hooks", | ||
"version": "0.1.47", | ||
"version": "0.1.48", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -0,0 +0,0 @@ # Vue 3 + TypeScript + Vite |
@@ -0,0 +0,0 @@ import path from "path"; |
@@ -0,0 +0,0 @@ export * from "./useCopy"; |
@@ -0,0 +0,0 @@ declare module "*.vue" { |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import { TTargetAttr } from "./type"; |
@@ -0,0 +0,0 @@ /** |
@@ -418,2 +418,36 @@ /** | ||
} | ||
// 获取用户定位 | ||
getWxLocation() { | ||
return new Promise(function (resolve, reject) { | ||
wx?.ready(function () { | ||
wx?.getLocation({ | ||
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' | ||
success: function (res) { | ||
resolve({ | ||
latitude: res.latitude, | ||
longitude: res.longitude, | ||
speed: res.speed, // 速度,以米/每秒计 | ||
accuracy: res.accuracy, // 位置精度 | ||
}); | ||
}, | ||
cancel: function () { | ||
reject("定位失败,请重新获取并允许定位"); | ||
}, | ||
fail: function () { | ||
reject("定位失败,请检查您设备权限后重新尝试"); | ||
}, | ||
}); | ||
}); | ||
wx?.error(function (err) { | ||
console.log(3); | ||
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。 | ||
reject(`wxjsapi-error: ${err}`); | ||
}); | ||
}); | ||
} | ||
openWxLocation(obj: any) { | ||
wx?.ready(() => { | ||
wx?.openLocation(obj); | ||
}) | ||
} | ||
// 设置过期时间 | ||
@@ -420,0 +454,0 @@ static setExpireTime(time: number) { |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ import { resolve } from "path"; |
Sorry, the diff of this file is not supported yet
84530
2651