From 42ef7265c70479d31751c8931f4bdbc42f0b60db Mon Sep 17 00:00:00 2001 From: Hilary Liu <110895612+GodlessLiu@users.noreply.github.com> Date: Thu, 24 Aug 2023 22:38:14 +0800 Subject: [PATCH] feat: store attachment view type to localStorage (#4477) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /kind console #### What this PR does / why we need it: 修改附件显示模式后,保存状态 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/4476 #### Does this PR introduce a user-facing change? ```release-note Console 端附件管理的显示模式支持缓存到浏览器。 ``` --- console/src/modules/contents/attachments/AttachmentList.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/console/src/modules/contents/attachments/AttachmentList.vue b/console/src/modules/contents/attachments/AttachmentList.vue index 333dc42bc..0ba883bb8 100644 --- a/console/src/modules/contents/attachments/AttachmentList.vue +++ b/console/src/modules/contents/attachments/AttachmentList.vue @@ -42,6 +42,7 @@ import { useRouteQuery } from "@vueuse/router"; import { useFetchAttachmentGroup } from "./composables/use-attachment-group"; import { usePermission } from "@/utils/permission"; import { useI18n } from "vue-i18n"; +import { useLocalStorage } from "@vueuse/core"; import UserFilterDropdown from "@/components/filter/UserFilterDropdown.vue"; const { currentUserHasPermission } = usePermission(); @@ -196,7 +197,7 @@ const viewTypes = [ }, ]; -const viewType = useRouteQuery("view", "list"); +const viewType = useLocalStorage("attachment-view-type", "list"); // Route query action const routeQueryAction = useRouteQuery("action");