From 4a51a5cfcbd484a0dac107762bbf10db80ab4194 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 19 May 2022 16:41:52 +0800 Subject: [PATCH] perf: improve posts page ui Signed-off-by: Ryan Wang --- src/core/icons.ts | 3 + src/views/contents/posts/PostList.vue | 145 ++++++++++++++------------ 2 files changed, 84 insertions(+), 64 deletions(-) diff --git a/src/core/icons.ts b/src/core/icons.ts index 1e5aeb0d..3fcc534c 100644 --- a/src/core/icons.ts +++ b/src/core/icons.ts @@ -5,6 +5,8 @@ import IconArrowLeft from "~icons/ri/arrow-left-s-line"; // @ts-ignore import IconArrowRight from "~icons/ri/arrow-right-s-line"; // @ts-ignore +import IconArrowDown from "~icons/ri/arrow-down-s-fill"; +// @ts-ignore import IconBookRead from "~icons/ri/book-read-line"; // @ts-ignore import IconPages from "~icons/ri/pages-line"; @@ -45,6 +47,7 @@ export { IconDashboard, IconArrowLeft, IconArrowRight, + IconArrowDown, IconBookRead, IconPages, IconMessage, diff --git a/src/views/contents/posts/PostList.vue b/src/views/contents/posts/PostList.vue index a50d7401..1fe62e2c 100644 --- a/src/views/contents/posts/PostList.vue +++ b/src/views/contents/posts/PostList.vue @@ -13,9 +13,10 @@ import { IconArrowRight, IconBookRead, IconSettings, + IconArrowDown, } from "@/core/icons"; import { posts } from "./posts-mock"; -import { ref } from "vue"; +import { computed, ref } from "vue"; import type { Post } from "@halo-dev/admin-api"; const postsRef = ref( @@ -35,6 +36,10 @@ const settingActiveId = ref("general"); const selected = ref>({}); const saving = ref(false); +const checkedCount = computed(() => { + return postsRef.value.filter((post) => post.checked).length; +}); + const handleCheckAll = () => { postsRef.value.forEach((item) => { item.checked = checkAll.value; @@ -60,7 +65,6 @@ const handleSelectNext = () => { selected.value = posts[currentIndex + 1]; } }; -handleCheckAll();