mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2025-06-07 11:20:16 +09:00
19 lines
418 B
JavaScript
19 lines
418 B
JavaScript
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]))
|
|
}
|
|
} |