|
- import storage from '@system.storage'
- export default {
- async onget() {
- console.log("获取")
- let a = await this.get(21)
- console.log(a)
- },
- async onsave() {
- console.log("存储")
- let a = await this.set(21)
- console.log(a)
- },
- get(id) {
- return new Promise((resolve, reject) => {
- storage.get({
- key: 'adv_' + id,
- success: data => {
- console.log(data)
- resolve(data);
- },
- fail: err => {
- resolve(err);
- }
- });
- });
- },
- set(id) {
- return new Promise((resolve, reject) => {
- storage.set({
- key: 'adv_' + id,
- value: id,
- success: (res) => {
- console.log(res)
- resolve('set success')
- },
- fail: (err) => {
- resolve('set failed')
- }
- })
- })
- },
- }
复制代码
https://doc.quickapp.cn/tutorial ... -async.html?h=async |
|