1.需要异步加载几个参数然后进行网络请求
1.1数据存储类,异步读取数据
import {storage} from "./Storage";
export default class StorageOpt{
/**
key:保存的key值
object:保存的value
expires:有效时间,
*/
static save(key,object,expires){
storage.save({
key: key, // 注意:请不要在key中使用_下划线符号!
data: object,
// 如果不指定过期时间,则会使用defaultExpires参数
// 如果设为null,则永不过期
expires: expires
});
}
/**
* 删除指定key的值
* @param key
*/
static delete(key){
// 删除单个数据
storage.remove({
key: key
});
}
/**
* 通过key加载数据
*/
static loadDefault(key,callBack){
StorageOpt.load(key, null, null, callBack);
}
/**
* 通过key加载数据
*/
static load(key,params,someFlag,callBack){
storage.load({
key: key,
// autoSync(默认为true)意味着在没有找到数据或数据过期时自动调用相应