From d1041428f0b1e942d9d7821bc4530b5ae6a6bce4 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Wed, 16 Aug 2023 23:45:08 +0800 Subject: [PATCH] feat: added dropdown menu for switching categories in top search bar * style: fixed style bugs on the favorite page --- .../views/Favorites/Favorites.vue | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/src/contentScripts/views/Favorites/Favorites.vue b/src/contentScripts/views/Favorites/Favorites.vue index 69dd1e3e..427feb03 100644 --- a/src/contentScripts/views/Favorites/Favorites.vue +++ b/src/contentScripts/views/Favorites/Favorites.vue @@ -8,13 +8,14 @@ const { t } = useI18n() const favoriteCategories = reactive>([]) const favoriteResources = reactive>([]) +const categoryOptions = reactive>([]) const selectedCategory = ref() const currentPageNum = ref(1) const keyword = ref('') -const isLoading = ref() +const isLoading = ref(true) const noMoreContent = ref() onMounted(async () => { @@ -35,24 +36,6 @@ onUnmounted(() => { emitter.off('reachBottom') }) -/** - * Get watch later list - */ -// function getAllWatchLaterList() { -// isLoading.value = true -// watchLaterList.length = 0 -// browser.runtime -// .sendMessage({ -// contentScriptQuery: 'getAllWatchLaterList', -// }) -// .then((res) => { -// if (res.code === 0) -// Object.assign(watchLaterList, res.data.list) - -// isLoading.value = false -// }) -// } - async function getFavoriteCategories() { await browser.runtime .sendMessage({ @@ -62,9 +45,15 @@ async function getFavoriteCategories() { .then((res) => { if (res.code === 0) { Object.assign(favoriteCategories, res.data.list) - noMoreContent.value = false + + categoryOptions.length = 0 + favoriteCategories.forEach((item) => { + categoryOptions.push({ + label: item.title, + value: item, + }) + }) } - isLoading.value = false }) } @@ -137,9 +126,10 @@ function jumpToLoginPage() { {{ selectedCategory?.title }} -->
+