Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
4310d2de
U
uni-api
项目概览
DCloud
/
uni-api
通知
671
Star
23
Fork
12
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4310d2de
编写于
10月 30, 2023
作者:
DCloud-yyl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
开源uni.exit模块
上级
214aec20
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
210 addition
and
0 deletion
+210
-0
uni_modules/uni-exit/changelog.md
uni_modules/uni-exit/changelog.md
+0
-0
uni_modules/uni-exit/package.json
uni_modules/uni-exit/package.json
+93
-0
uni_modules/uni-exit/readme.md
uni_modules/uni-exit/readme.md
+6
-0
uni_modules/uni-exit/utssdk/app-android/index.uts
uni_modules/uni-exit/utssdk/app-android/index.uts
+15
-0
uni_modules/uni-exit/utssdk/app-ios/index.uts
uni_modules/uni-exit/utssdk/app-ios/index.uts
+13
-0
uni_modules/uni-exit/utssdk/interface.uts
uni_modules/uni-exit/utssdk/interface.uts
+63
-0
uni_modules/uni-exit/utssdk/unierror.uts
uni_modules/uni-exit/utssdk/unierror.uts
+20
-0
未找到文件。
uni_modules/uni-exit/changelog.md
0 → 100644
浏览文件 @
4310d2de
uni_modules/uni-exit/package.json
0 → 100644
浏览文件 @
4310d2de
{
"id"
:
"uni-exit"
,
"displayName"
:
"uni-exit"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-exit"
,
"keywords"
:
[
"uni-exit"
],
"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"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"exit"
:
{
"name"
:
"exit"
,
"app"
:
{
"js"
:
true
,
"kotlin"
:
true
,
"swift"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
"y"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
\ No newline at end of file
uni_modules/uni-exit/readme.md
0 → 100644
浏览文件 @
4310d2de
# uni-quit
### 开发文档
[
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-exit/utssdk/app-android/index.uts
0 → 100644
浏览文件 @
4310d2de
import { ExitOptions, ExitSuccess, ExitCompleteCallback, Exit } from "../interface.uts"
/**
* 实现uni.exit
*/
export const exit : Exit = function (options: ExitOptions | null) {
let ret : ExitSuccess ={
errMsg: "exit:ok"
}
options?.success?.(ret)
options?.complete?.(ret)
UTSAndroid.exit()
}
uni_modules/uni-exit/utssdk/app-ios/index.uts
0 → 100644
浏览文件 @
4310d2de
import { ExitOptions, ExitFailCallback, ExitCompleteCallback, Exit} from "../interface.uts"
import { UniErrorSubject, UniErrors } from "../unierror.uts"
/**
* 实现uni.exit
* iOS平台不支持,触发错误回调
*/
export const exit : Exit = function (options: ExitOptions | null) {
let err = new UniError(UniErrorSubject, 12001, UniErrors.get(12001)!);
options?.fail?.(err)
options?.complete?.(err)
}
uni_modules/uni-exit/utssdk/interface.uts
0 → 100644
浏览文件 @
4310d2de
/**
* uni.exit成功回调参数
*/
export type ExitSuccess = {
errMsg: string
}
/**
* uni.exit成功回调函数定义
*/
export type ExitSuccessCallback = (res: ExitSuccess) => void
/**
* uni.exit失败回调函数定义
*/
export type ExitFailCallback = (res: UniError) => void
/**
* uni.exit完成回调函数定义
*/
export type ExitCompleteCallback = (res: any) => void
/**
* uni.exit参数定义
*/
export type ExitOptions = {
/**
* 接口调用成功的回调函数
*/
success?: ExitSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: ExitFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: ExitCompleteCallback | null
}
export interface Uni {
/**
* 退出当前应用
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4.4",
* "uniVer": "3.8.15",
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
exit(options?: ExitOptions | null):void;
}
export type Exit = (options?: ExitOptions | null) => void;
uni_modules/uni-exit/utssdk/unierror.uts
0 → 100644
浏览文件 @
4310d2de
/**
* 错误主题
*/
export const UniErrorSubject = 'uni-exit';
/**
* 错误码
* @UniError
*/
export const UniErrors:Map<number, string> = new Map([
/**
* 系统不支持
*/
[12001, 'system not support'],
/**
* 未知错误
*/
[12002, 'unknown error']
]);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录