diff --git a/pages/groups/index.vue b/pages/groups/index.vue index 4d114da1..352a2568 100644 --- a/pages/groups/index.vue +++ b/pages/groups/index.vue @@ -231,6 +231,7 @@ type Data = { sort_displayname: string query_cache: any search_result_number: number + storage_bookmarks: (string | null)[] display_bookmarks: boolean selectedTag: Tag | undefined } @@ -255,6 +256,7 @@ export default Vue.extend({ search_result_number: 0, search_query: '', sort_displayname: 'デフォルト順', + storage_bookmarks: [], display_bookmarks: false, query_cache: undefined, } @@ -321,6 +323,9 @@ export default Vue.extend({ } }, mounted() { + for (let i = 0; i < localStorage.length; i++) { + this.storage_bookmarks.push(localStorage.key(i)) + } this.nowloading = false }, @@ -334,6 +339,7 @@ export default Vue.extend({ R = R === null ? this.$route.query.r : R this.$router.push({ query: { q: Q, t: T, b: B, s: S, r: R } }) // nullは「現在のクエリを維持」と同義 }, + SortGroups(sort: 'id' | 'groupname' | 'title') { if (sort === 'groupname') { this.sort_displayname = '団体名順' @@ -439,13 +445,13 @@ export default Vue.extend({ FilterBookmarks(id: string) { // お気に入りならtrue - if (this.nowloading === true) return false - for (let i = 0; i < localStorage.length; i++) { - if ('seiryofes.groups.favorite.' + id === localStorage.key(i)) { - return true - } + if (this.nowloading === true) { + return false + } else { + return this.storage_bookmarks.includes( + 'seiryofes.groups.favorite.' + id + ) } - return false }, HashColor(text: string) {