mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 20:01:10 +00:00
feat: sf metadata display (#6249)
* feat: sf metadata display * feat: update code * feat: update code * feat: lock react version * feat: bug * feat: optimize code * feat: update transalte * feat: update transalte * feat: rebase code * Feat: update code * Feat: update code --------- Co-authored-by: 杨国璇 <ygx@192.168.1.5> Co-authored-by: 杨国璇 <ygx@Hello-word.local> Co-authored-by: 杨国璇 <ygx@192.168.1.13>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
class LocalStorage {
|
||||
|
||||
constructor(baseName) {
|
||||
this.baseName = baseName || 'sf-metadata';
|
||||
}
|
||||
|
||||
getStorage() {
|
||||
try {
|
||||
return JSON.parse(window.localStorage.getItem(this.baseName) || '{}');
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
setItem(key, value) {
|
||||
const storage = this.getStorage();
|
||||
const newValue = { ...storage, [key]: value };
|
||||
return window.localStorage.setItem(this.baseName, JSON.stringify(newValue));
|
||||
}
|
||||
|
||||
getItem(key) {
|
||||
const storage = this.getStorage();
|
||||
return storage[key];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default LocalStorage;
|
Reference in New Issue
Block a user