diff --git a/src/api/home/types/home.ts b/src/api/home/types/home.ts
index 6441fdee..065fce14 100644
--- a/src/api/home/types/home.ts
+++ b/src/api/home/types/home.ts
@@ -22,7 +22,7 @@ export interface HomeTopicRequestData {
page: number
limit: number
sortField: string
- sortOrder: 'asc' | 'desc'
+ sortOrder: string
}
export interface HomeTopic {
diff --git a/src/components/KUNGalgameSearchBox.vue b/src/components/KUNGalgameSearchBox.vue
index d8ed347d..75508176 100644
--- a/src/components/KUNGalgameSearchBox.vue
+++ b/src/components/KUNGalgameSearchBox.vue
@@ -57,22 +57,6 @@ const debouncedSearch = debounce((inputValue: string) => {
/>
-
- 啊这可海星啊这可海星啊这可海星啊这可海星啊这可海星
-
-
-
- 啊这可海星啊这可海星啊这可海星啊这可海星啊这可海星
-
-
diff --git a/src/store/modules/home.ts b/src/store/modules/home.ts
index cd667bad..b9e92944 100644
--- a/src/store/modules/home.ts
+++ b/src/store/modules/home.ts
@@ -11,7 +11,8 @@ import {
export const useKUNGalgameHomeStore = defineStore({
id: 'home',
persist: true,
- state: (): HomeTopicRequestData => ({
+ state: () => ({
+ // 搜索框的 store
/**
* @param {String} keywords - 搜索关键词,不填默认全部
* @param {Array} category - 话题的分类,目前有三种,Galgame, Technique, Others
@@ -27,12 +28,15 @@ export const useKUNGalgameHomeStore = defineStore({
limit: 17,
sortField: 'updated',
sortOrder: 'desc',
+
+ // 其它的 store
+ isActiveMainPageAside: true,
}),
getters: {},
actions: {
// 获取首页话题
getHomeTopic(): Promise {
- const requestData = {
+ const requestData: HomeTopicRequestData = {
keywords: this.keywords,
category: this.category,
page: this.page,
diff --git a/src/views/Home/content/aside/MainPageAside.vue b/src/views/Home/content/aside/MainPageAside.vue
index fe38ee6b..764363a2 100644
--- a/src/views/Home/content/aside/MainPageAside.vue
+++ b/src/views/Home/content/aside/MainPageAside.vue
@@ -7,28 +7,20 @@ import AsideActive from './components/AsideActive.vue'
import Aside from './components/Aside.vue'
-// 用户点击折叠左侧区域
-const asideBarStatus = (): boolean => {
- if (localStorage.getItem('KUNGalgame-main-page-aside') === 'true') {
- return true
- } else {
- return false
- }
-}
+// 导入用户 store
+import { useKUNGalgameHomeStore } from '@/store/modules/home'
+import { storeToRefs } from 'pinia'
+
+const { isActiveMainPageAside } = storeToRefs(useKUNGalgameHomeStore())
-const isActive = ref(asideBarStatus())
const asideWidth = ref('240px')
const handleFold = () => {
- isActive.value = !isActive.value
+ isActiveMainPageAside.value = !isActiveMainPageAside.value
}
watch(
- isActive,
+ isActiveMainPageAside,
() => {
- localStorage.setItem(
- 'KUNGalgame-main-page-aside',
- isActive.value.toString()
- )
- asideWidth.value = isActive.value ? '240px' : '40px'
+ asideWidth.value = isActiveMainPageAside.value ? '240px' : '40px'
},
{ immediate: true }
)
@@ -40,20 +32,26 @@ watch(
-
+
- {{ $tm('mainPage.asideActive.fold') }}
+ {{
+ $tm('mainPage.asideActive.fold')
+ }}
-