class DataJs {
constructor() {
this.data = {};
}
getData(name) {
if (!name) {
return null;
}
return this.data[name];
}
setData(params = {}) {
for (let i in params) {
this.data[i] = params[i];
}
}
clearData(name) {
if (name) {
delete this.data[name];
// this.data[name] = null;
}
}
clearAll() {
this.data = {};
}
};
export default new DataJs();
网友评论