Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
erosXXX
uni-app
提交
fa38b268
U
uni-app
项目概览
erosXXX
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fa38b268
编写于
4月 13, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev-quickapp' of
https://github.com/dcloudio/uni-app
into dev-quickapp
上级
a78458f8
87bd34b0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
154 addition
and
1 deletion
+154
-1
src/platforms/quickapp-vue/service/api/storage/storage.js
src/platforms/quickapp-vue/service/api/storage/storage.js
+107
-0
src/platforms/quickapp-vue/service/api/ui/popup.js
src/platforms/quickapp-vue/service/api/ui/popup.js
+40
-0
src/platforms/quickapp-vue/service/platform-api.js
src/platforms/quickapp-vue/service/platform-api.js
+7
-1
未找到文件。
src/platforms/quickapp-vue/service/api/storage/storage.js
0 → 100644
浏览文件 @
fa38b268
import
{
invoke
}
from
'
../../bridge
'
import
storage
from
'
@system.storage
'
function
parseValue
(
value
)
{
const
types
=
[
'
object
'
,
'
string
'
,
'
number
'
,
'
boolean
'
,
'
undefined
'
]
try
{
const
object
=
typeof
value
===
'
string
'
?
JSON
.
parse
(
value
)
:
value
const
type
=
object
.
type
if
(
types
.
indexOf
(
type
)
>=
0
)
{
const
keys
=
Object
.
keys
(
object
)
// eslint-disable-next-line valid-typeof
if
(
keys
.
length
===
2
&&
'
data
'
in
object
&&
typeof
object
.
data
===
type
)
{
return
object
.
data
}
else
if
(
keys
.
length
===
1
)
{
return
''
}
}
}
catch
(
error
)
{}
}
export
function
setStorage
({
key
,
data
,
isSync
}
=
{},
callbackId
)
{
const
type
=
typeof
data
const
value
=
type
===
'
string
'
?
data
:
JSON
.
stringify
({
type
,
data
:
data
})
try
{
storage
.
set
({
key
,
value
,
success
:
(
res
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
'
setStorage:ok
'
})
},
fail
:
(
data
,
code
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
`setStorage:fail
${
code
}
`
})
}
})
}
catch
(
error
)
{
invoke
(
callbackId
,
{
errMsg
:
`setStorage:fail
${
error
}
`
})
}
}
export
function
getStorage
({
key
}
=
{},
callbackId
)
{
storage
.
get
({
key
,
success
:
(
data
)
=>
{
invoke
(
callbackId
,
{
data
:
parseValue
(
data
)
||
data
,
errMsg
:
'
getStorage:ok
'
})
},
fail
:
(
data
,
code
)
=>
{
invoke
(
callbackId
,
{
data
:
''
,
errMsg
:
`getStorage:fail
${
code
}
`
})
}
})
}
export
function
removeStorage
({
key
}
=
{},
callbackId
)
{
storage
.
delete
({
key
,
success
:
(
res
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
'
removeStorage:ok
'
})
},
fail
:
(
data
,
code
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
`removeStorage:fail
${
code
}
`
})
}
})
}
export
function
clearStorage
(
args
,
callbackId
)
{
storage
.
clear
({
success
:
(
res
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
'
clearStorage:ok
'
})
},
fail
:
(
data
,
code
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
`clearStorage:fail
${
code
}
`
})
}
})
}
src/platforms/quickapp-vue/service/api/ui/popup.js
0 → 100644
浏览文件 @
fa38b268
import
{
invoke
}
from
'
../../bridge
'
import
prompt
from
'
@system.prompt
'
export
function
showModal
({
title
=
''
,
content
=
''
,
showCancel
=
true
,
cancelText
=
'
取消
'
,
cancelColor
=
'
#000000
'
,
confirmText
=
'
确定
'
,
confirmColor
=
'
#3CC51F
'
}
=
{},
callbackId
)
{
prompt
.
showDialog
({
title
:
title
,
message
:
content
,
buttons
:
[
{
text
:
'
确定
'
,
color
:
confirmColor
}
],
success
:
(
data
)
=>
{
console
.
log
(
'
handling callback
'
)
invoke
(
callbackId
,
{
errMsg
:
'
showModal:ok
'
,
confirm
:
true
,
cancel
:
false
})
},
cancel
:
()
=>
{
console
.
log
(
'
handling cancel
'
)
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
`handling fail, code =
${
code
}
`
)
}
})
}
src/platforms/quickapp-vue/service/platform-api.js
浏览文件 @
fa38b268
...
...
@@ -6,4 +6,10 @@ export * from './api/route/redirect-to'
export
*
from
'
./api/device/clipboard
'
// network
export
*
from
'
./api/network/request
'
export
*
from
'
./api/network/request
'
// storage
export
*
from
'
./api/storage/storage
'
// ui
export
*
from
'
./api/ui/popup
'
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录