Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
612e2791
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6058
Star
93
Fork
166
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
612e2791
编写于
12月 10, 2024
作者:
VK1688
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
App端新增uni.openLocation
上级
bcaac514
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
1241 addition
and
14 deletion
+1241
-14
Info.plist
Info.plist
+3
-0
pages.json
pages.json
+12
-2
pages/API/open-location/open-location.uvue
pages/API/open-location/open-location.uvue
+14
-12
uni_modules/uni-openLocation/changelog.md
uni_modules/uni-openLocation/changelog.md
+6
-0
uni_modules/uni-openLocation/package.json
uni_modules/uni-openLocation/package.json
+98
-0
uni_modules/uni-openLocation/pages/openLocation/openLocation.uvue
...les/uni-openLocation/pages/openLocation/openLocation.uvue
+527
-0
uni_modules/uni-openLocation/readme.md
uni_modules/uni-openLocation/readme.md
+11
-0
uni_modules/uni-openLocation/static/target.png
uni_modules/uni-openLocation/static/target.png
+0
-0
uni_modules/uni-openLocation/utssdk/app-android/index.uts
uni_modules/uni-openLocation/utssdk/app-android/index.uts
+36
-0
uni_modules/uni-openLocation/utssdk/app-ios/Info.plist
uni_modules/uni-openLocation/utssdk/app-ios/Info.plist
+14
-0
uni_modules/uni-openLocation/utssdk/app-ios/index.uts
uni_modules/uni-openLocation/utssdk/app-ios/index.uts
+36
-0
uni_modules/uni-openLocation/utssdk/interface.uts
uni_modules/uni-openLocation/utssdk/interface.uts
+418
-0
uni_modules/uni-openLocation/utssdk/unierror.uts
uni_modules/uni-openLocation/utssdk/unierror.uts
+30
-0
uni_modules/uni-openLocation/utssdk/web/index.uts
uni_modules/uni-openLocation/utssdk/web/index.uts
+36
-0
未找到文件。
Info.plist
浏览文件 @
612e2791
...
...
@@ -31,6 +31,9 @@
<string>
alipay
</string>
<string>
safepay
</string>
<string>
weixin
</string>
<string>
qqmap
</string>
<string>
iosamap
</string>
<string>
baidumap
</string>
</array>
</dict>
</plist>
pages.json
浏览文件 @
612e2791
...
...
@@ -893,7 +893,7 @@
}
},
//
#endif
//
#ifdef
WEB
||
MP-WEIXIN
//
#ifdef
APP-ANDROID
||
APP-IOS
||
WEB
||
MP-WEIXIN
{
"path"
:
"pages/API/open-location/open-location"
,
"group"
:
"1,9,1"
,
...
...
@@ -902,6 +902,16 @@
}
},
//
#endif
//
#ifdef
APP-ANDROID
||
APP-IOS
||
WEB
{
"path"
:
"uni_modules/uni-openLocation/pages/openLocation/openLocation"
,
"style"
:
{
"navigationBarTitleText"
:
" "
,
"navigationStyle"
:
"custom"
,
"disableSwipeBack"
:
false
}
},
//
#endif
//
#ifdef
APP-ANDROID
||
APP-IOS
||
WEB
||
MP-WEIXIN
{
"path"
:
"pages/API/choose-location/choose-location"
,
...
...
@@ -2397,7 +2407,7 @@
}
}
//
#endif
],
],
"globalStyle"
:
{
"pageOrientation"
:
"portrait"
,
"navigationBarTitleText"
:
"Hello uniapp x"
,
...
...
pages/API/open-location/open-location.uvue
浏览文件 @
612e2791
...
...
@@ -9,7 +9,7 @@
<view class="uni-label">经度</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input" type="text" :disabled="true" value="116.39747" name="longitud
e" />
<input
v-model.number="longitude" class="uni-input" type="text" :disabled="tru
e" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -17,7 +17,7 @@
<view class="uni-label">纬度</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input" type="text" :disabled="true" value="39.9085" name="latitud
e" />
<input
v-model.number="latitude" class="uni-input" type="text" :disabled="tru
e" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -25,7 +25,7 @@
<view class="uni-label">位置名称</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input" type="text" :disabled="true" value="天安门" name="nam
e" />
<input
v-model="name" class="uni-input" type="text" :disabled="tru
e" />
</view>
</view>
<view class="uni-list-cell">
...
...
@@ -33,7 +33,7 @@
<view class="uni-label">详细位置</view>
</view>
<view class="uni-list-cell-db">
<input
class="uni-input" type="text" :disabled="true" value="北京市东城区东长安街" name="address
" />
<input
v-model="address" class="uni-input" type="text" :disabled="true
" />
</view>
</view>
</view>
...
...
@@ -51,21 +51,23 @@
export default {
data() {
return {
title: 'openLocation'
title: 'openLocation',
longitude: 116.39747,
latitude: 39.9085,
name: '天安门',
address: '北京市东城区东长安街'
}
},
onHide() {
console.log("Page Hide");
},
methods: {
openLocation: function (e) {
console.log(e)
var value = e.detail.value
openLocation: function () {
uni.openLocation({
longitude:
Number(value.longitude)
,
latitude:
Number(value.latitude)
,
name:
value
.name,
address:
value
.address
longitude:
this.longitude
,
latitude:
this.latitude
,
name:
this
.name,
address:
this
.address
})
}
}
...
...
uni_modules/uni-openLocation/changelog.md
0 → 100644
浏览文件 @
612e2791
## 1.0.2(2024-12-10)
ios端支持侧滑关闭
## 1.0.1(2024-12-10)
插件新增文件pages_init.json,方便注册页面
## 1.0.0(2024-12-09)
发布API uni.openLocation 需 HBuilderX 4.41+
uni_modules/uni-openLocation/package.json
0 → 100644
浏览文件 @
612e2791
{
"id"
:
"uni-openLocation"
,
"displayName"
:
"uni-openLocation"
,
"version"
:
"1.0.2"
,
"description"
:
"实现APP端的 uni.openLocation"
,
"keywords"
:
[
"uni-openLocation"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
"无"
,
"data"
:
"插件不采集任何数据"
,
"permissions"
:
"无"
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[
"uts-openSchema"
],
"uni-ext-api"
:
{
"uni"
:
{
"openLocation"
:
{
"name"
:
"openLocation"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
true
,
"swift"
:
true
,
"arkts"
:
false
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"y"
,
"aliyun"
:
"y"
,
"alipay"
:
"y"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
"y"
,
"app-ios"
:
"y"
,
"app-harmony"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"y"
,
"Android Browser"
:
"y"
,
"微信浏览器(Android)"
:
"y"
,
"QQ浏览器(Android)"
:
"y"
},
"H5-pc"
:
{
"Chrome"
:
"y"
,
"IE"
:
"u"
,
"Edge"
:
"y"
,
"Firefox"
:
"y"
,
"Safari"
:
"y"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-openLocation/pages/openLocation/openLocation.uvue
0 → 100644
浏览文件 @
612e2791
此差异已折叠。
点击以展开。
uni_modules/uni-openLocation/readme.md
0 → 100644
浏览文件 @
612e2791
# uni-openLocation
> 需 HBuilderX 4.41+
[
使用文档
](
https://doc.dcloud.net.cn/uni-app-x/api/open-location.html
)
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS API插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
UTS 组件插件
](
https://uniapp.dcloud.net.cn/plugin/uts-component.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts
)
\ No newline at end of file
uni_modules/uni-openLocation/static/target.png
0 → 100644
浏览文件 @
612e2791
1.2 KB
uni_modules/uni-openLocation/utssdk/app-android/index.uts
0 → 100644
浏览文件 @
612e2791
import { OpenLocation, OpenLocationOptions, OpenLocationSuccessImpl, OpenLocationErrorCode } from "../interface.uts"
import { OpenLocationFailImpl } from "../unierror.uts"
export const openLocation : OpenLocation = function (options : OpenLocationOptions) {
const uuid = `${Date.now()}${Math.floor(Math.random() * 1e7)}`
const baseEventName = `uni_open_location_${uuid}`
const readyEventName = `${baseEventName}_ready`
const optionsEventName = `${baseEventName}_options`
const successEventName = `${baseEventName}_success`
const failEventName = `${baseEventName}_fail`
const readyEventId = uni.$on(readyEventName, () => {
uni.$emit(optionsEventName, JSON.parse(JSON.stringify(options)))
})
const successEventId = uni.$on(successEventName, () => {
const res = new OpenLocationSuccessImpl()
options.success?.(res)
options.complete?.(res)
})
const failEventId = uni.$on(failEventName, (errCode : OpenLocationErrorCode) => {
const res = new OpenLocationFailImpl(errCode)
options.fail?.(res)
options.complete?.(res)
})
uni.openDialogPage({
url: `/uni_modules/uni-openLocation/pages/openLocation/openLocation?readyEventName=${readyEventName}&optionsEventName=${optionsEventName}&successEventName=${successEventName}&failEventName=${failEventName}`,
fail(err) {
const res = new OpenLocationFailImpl(4)
options.fail?.(res)
options.complete?.(res)
uni.$off(readyEventName, readyEventId)
uni.$off(successEventName, successEventId)
uni.$off(failEventName, failEventId)
}
})
};
uni_modules/uni-openLocation/utssdk/app-ios/Info.plist
0 → 100644
浏览文件 @
612e2791
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
LSApplicationQueriesSchemes
</key>
<array>
<string>
qqmap
</string>
<string>
iosamap
</string>
<string>
baidumap
</string>
</array>
</dict>
</plist>
uni_modules/uni-openLocation/utssdk/app-ios/index.uts
0 → 100644
浏览文件 @
612e2791
import { OpenLocation, OpenLocationOptions, OpenLocationSuccessImpl } from "../interface.uts"
import { OpenLocationFailImpl } from "../unierror.uts"
export const openLocation : OpenLocation = function (options : OpenLocationOptions) {
const uuid = `${Date.now()}${Math.floor(Math.random() * 1e7)}`
const baseEventName = `uni_open_location_${uuid}`
const readyEventName = `${baseEventName}_ready`
const optionsEventName = `${baseEventName}_options`
const successEventName = `${baseEventName}_success`
const failEventName = `${baseEventName}_fail`
uni.$on(readyEventName, (..._ : any) => {
uni.$emit(optionsEventName, JSON.parse(JSON.stringify(options)!))
})
uni.$on(successEventName, (..._ : any) => {
const res = new OpenLocationSuccessImpl()
options.success?.(res)
options.complete?.(res)
})
uni.$on(failEventName, (..._ : any) => {
const res = new OpenLocationFailImpl(4)
options.fail?.(res)
options.complete?.(res)
})
uni.openDialogPage({
url: `/uni_modules/uni-openLocation/pages/openLocation/openLocation?readyEventName=${readyEventName}&optionsEventName=${optionsEventName}&successEventName=${successEventName}&failEventName=${failEventName}`,
fail(err) {
const res = new OpenLocationFailImpl(4)
options.fail?.(res)
options.complete?.(res)
uni.$off(readyEventName)
uni.$off(successEventName)
uni.$off(failEventName)
}
})
};
uni_modules/uni-openLocation/utssdk/interface.uts
0 → 100644
浏览文件 @
612e2791
/**
* 错误码
*/
export type OpenLocationErrorCode =
/**
* 框架内部错误
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
*/
4;
export interface OpenLocationSuccess {
errMsg: string
}
type OpenLocationSuccessCallback = (result : OpenLocationSuccess) => void
export interface OpenLocationFail extends IUniError {
errCode : OpenLocationErrorCode
}
type OpenLocationFailCallback = (result : OpenLocationFail) => void
export type OpenLocationComplete = any
type OpenLocationCompleteCallback = (result : OpenLocationComplete) => void
/**
* uni.openLocation函数参数定义
*/
export type OpenLocationOptions = {
/**
* 纬度,范围为-90~90,负数表示南纬,使用 gcj02 国测局坐标系
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
latitude : number,
/**
* 经度,范围为-180~180,负数表示西经,使用 gcj02 国测局坐标系
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
longitude : number,
/**
* 缩放比例,范围5~18,默认为18(微信小程序)
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
scale ?: number | null,
/**
* 位置名
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
name ?: string | null,
/**
* 地址的详细说明
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
address ?: string | null,
/**
* 接口调用成功的回调函数
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
success ?: OpenLocationSuccessCallback | null,
/**
* 接口调用失败的回调函数
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
fail ?: OpenLocationFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
complete ?: OpenLocationCompleteCallback | null
};
/**
* 使用应用内置地图查看位置
*
* @param {OpenLocationOptions} options
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/prompt.html#openLocation
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
export type OpenLocation = (options : OpenLocationOptions) => void;
export interface Uni {
/**
* @description 使用应用内置地图查看位置
* @example
* ```typescript
uni.openLocation({
latitude: 39.908823,
longitude: 116.39747,
success: (res) => {
console.log('res: ', res)
},
fail: (err) => {
console.log('err: ', err)
},
complete: (res) => {
console.log('complete: ', res)
}
});
* ```
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/prompt.html#openLocation
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.41"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "uniVer": "√",
* "unixVer": "4.41"
* }
* }
* }
*/
openLocation(options : OpenLocationOptions) : void;
}
export class OpenLocationSuccessImpl implements OpenLocationSuccess {
errMsg : string
constructor(errMsg : string = 'chooseLocation:ok') {
this.errMsg = errMsg
}
}
uni_modules/uni-openLocation/utssdk/unierror.uts
0 → 100644
浏览文件 @
612e2791
import { OpenLocationErrorCode, OpenLocationFail } from "./interface.uts"
/**
* 错误主题
*/
export const UniErrorSubject = 'uni-openLocation';
/**
* 错误码
* @UniError
*/
export const UniErrors : Map<OpenLocationErrorCode, string> = new Map([
/**
* 框架内部错误
*/
[4, 'internal error']
]);
export class OpenLocationFailImpl extends UniError implements OpenLocationFail {
// #ifndef APP-IOS
override errCode : OpenLocationErrorCode;
// #endif
constructor(errCode : OpenLocationErrorCode) {
super();
this.errSubject = UniErrorSubject;
this.errCode = errCode;
this.errMsg = UniErrors.get(errCode) ?? "";
}
}
uni_modules/uni-openLocation/utssdk/web/index.uts
0 → 100644
浏览文件 @
612e2791
import { OpenLocation, OpenLocationOptions, OpenLocationSuccessImpl, OpenLocationErrorCode } from "../interface.uts"
import { OpenLocationFailImpl } from "../unierror.uts"
export const openLocation : OpenLocation = function (options : OpenLocationOptions) {
const uuid = `${Date.now()}${Math.floor(Math.random() * 1e7)}`
const baseEventName = `uni_open_location_${uuid}`
const readyEventName = `${baseEventName}_ready`
const optionsEventName = `${baseEventName}_options`
const successEventName = `${baseEventName}_success`
const failEventName = `${baseEventName}_fail`
const readyEventId = uni.$on(readyEventName, () => {
uni.$emit(optionsEventName, JSON.parse(JSON.stringify(options)))
})
const successEventId = uni.$on(successEventName, () => {
const res = new OpenLocationSuccessImpl()
options.success?.(res)
options.complete?.(res)
})
const failEventId = uni.$on(failEventName, (errCode : OpenLocationErrorCode) => {
const res = new OpenLocationFailImpl(errCode)
options.fail?.(res)
options.complete?.(res)
})
uni.openDialogPage({
url: `/uni_modules/uni-openLocation/pages/openLocation/openLocation?readyEventName=${readyEventName}&optionsEventName=${optionsEventName}&successEventName=${successEventName}&failEventName=${failEventName}`,
fail(err) {
const res = new OpenLocationFailImpl(4)
options.fail?.(res)
options.complete?.(res)
uni.$off(readyEventName, readyEventId)
uni.$off(successEventName, successEventId)
uni.$off(failEventName, failEventId)
}
})
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录