1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-06-12 21:29:31 +08:00

feat: 新增文章点赞功能

This commit is contained in:
小莫唐尼
2024-11-06 19:23:13 +08:00
parent 7c15c84dba
commit e19b107ed0
3 changed files with 1367 additions and 1336 deletions
+19
View File
@@ -0,0 +1,19 @@
export const upvote = {
get(key) {
const data = uni.getStorageSync(`upvote.${key}.halo.run`)
if (data) {
return JSON.parse(data)
} else {
return []
}
},
has(key, name) {
const list = this.get(key)
if (list.length == 0) return false;
return list.includes(name)
},
set(key, name) {
const list = this.get(key)
uni.setStorageSync(`upvote.${key}.halo.run`, JSON.stringify([...list, name]))
}
}