提交 2ba58426 编写于 作者: 杜庆泉's avatar 杜庆泉

storage 示例增加 类型信息

上级 22d6befc
...@@ -197,10 +197,18 @@ export default { ...@@ -197,10 +197,18 @@ export default {
uni.getStorage({ uni.getStorage({
key: key, key: key,
success: (res) => { success: (res) => {
that.apiGetData = res.data that.apiGetData = res.data
let desc:string = typeof this.apiGetData
if("object" == desc){
desc = desc + ": " + JSON.stringify(this.apiGetData)
}else{
desc = desc + ": " + this.apiGetData
}
uni.showModal({ uni.showModal({
title: '读取数据成功', title: '读取数据成功',
content: "data: '" + JSON.stringify(that.apiGetData) + "'", content: desc,
showCancel: false, showCancel: false,
}) })
}, },
...@@ -223,10 +231,18 @@ export default { ...@@ -223,10 +231,18 @@ export default {
showCancel: false, showCancel: false,
}) })
} else { } else {
this.apiGetData = uni.getStorageSync(key) this.apiGetData = uni.getStorageSync(key)
let desc:string = typeof this.apiGetData
if("object" == desc){
desc = desc + ": " + JSON.stringify(this.apiGetData)
}else{
desc = desc + ": " + this.apiGetData
}
uni.showModal({ uni.showModal({
title: '读取数据成功', title: '读取数据成功',
content: "data: '" + JSON.stringify(apiGetData) + "'", content: desc,
showCancel: false, showCancel: false,
}) })
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册