Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
陈剑华
2024-05-20 16:44:04 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f32da341039b396299259238753d51a526cd15b4
f32da341
1 parent
11a6da8f
feat: 17492 功能缺陷-【uat】进入精选评论卡,点击点赞,未变成已点赞
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
sight_harmony/features/wdComponent/src/main/ets/utils/persistentStorage.ets
sight_harmony/features/wdComponent/src/main/ets/utils/persistentStorage.ets
View file @
f32da34
// PersistentStorage.persistProp('clickedIds', []);
//
// function persistentStorage(id: string | number, type: 'add' | 'remove' | undefined = 'add') {
// let clickedIds = AppStorage.get<string>('clickedIds')?.split(',') || [];
// let index = clickedIds.indexOf(id.toString())
// if (type === 'add') {
// if (index >= 0) return;
// clickedIds.push(id.toString());
// } else if (type === 'remove') {
// clickedIds.splice(index, 1);
// }
// AppStorage.set('clickedIds', clickedIds.join(','));
// }
//
// function hasClicked(id: string | number) {
// let clickedIds = AppStorage.get<string>('clickedIds')?.split(',') || [];
// let index = clickedIds.indexOf(id.toString())
// if (index >= 0) return true;
// return false;
// }
//
// export { persistentStorage, hasClicked }
\ No newline at end of file
PersistentStorage.persistProp('clickedIds', []);
function persistentStorage(id: string | number, type: 'add' | 'remove' | undefined = 'add') {
let _clickedIds = AppStorage.get<string[]>('clickedIds');
let clickedIds = _clickedIds?.toString()?.split(',') || [];
let index = clickedIds.indexOf(id.toString())
if (type === 'add') {
if (index >= 0) return;
clickedIds.push(id.toString());
} else if (type === 'remove') {
clickedIds.splice(index, 1);
}
AppStorage.set('clickedIds', clickedIds.join(','));
}
function hasClicked(id: string | number) {
let clickedIds = AppStorage.get<string>('clickedIds')?.split(',') || [];
let index = clickedIds.indexOf(id.toString())
if (index >= 0) return true;
return false;
}
export { persistentStorage, hasClicked }
\ No newline at end of file
...
...
Please
register
or
login
to post a comment