localStorage 添加 del 方法

This commit is contained in:
zhw2590582 committed 2019-05-12 10:02:42 +08:00
1 parent 6f34ea0da0
commit 773714f739
1 file changed
+6
+6
View File
@@ -25,6 +25,12 @@ export default class Storage {
window.localStorage.setItem(this.name, JSON.stringify(storage));
}
del(key) {
const storage = this.get();
delete storage[key];
window.localStorage.setItem(this.name, JSON.stringify(storage));
}
clean() {
window.localStorage.removeItem(this.name);
}