123456789101112131415161718192021222324252627282930313233 |
- module.exports = {
- setStore: setStore,
- getStore: getStore,
- remove: remove,
- }
- //同步储存缓存数据
- async function setStore(key, value) {
- try {
- wx.setStorageSync(key, value);
- } catch (e) { }
- };
- //同步取出缓存数据
- function getStore(key) {
- try {
- const strings = require('../utils/strings');
- var list = wx.getStorageSync(key);
- if (!strings.isEmpty(list)) {
- return list;
- }
- } catch (e) {
- return [];
- }
- return [];
- };
- //移除指定key
- function remove(key) {
- try {
- wx.removeStorageSync(key)
- } catch (e) { }
- }
|