作者 xiaoqiu

规范了类型

@@ -10,7 +10,7 @@ import { getClassifyList } from "~/api/classify"; @@ -10,7 +10,7 @@ import { getClassifyList } from "~/api/classify";
10 import type { webSiteType } from "~/api/types/webSite"; 10 import type { webSiteType } from "~/api/types/webSite";
11 import type { classifyType } from "~/api/types/classify"; 11 import type { classifyType } from "~/api/types/classify";
12 const webSite = useState<webSiteType>("webSite"); 12 const webSite = useState<webSiteType>("webSite");
13 -const sortList = useState<classifyType>("sortTree"); 13 +const sortList = useState<classifyType[]>("sortTree");
14 14
15 webSite.value = await getWebSite(); 15 webSite.value = await getWebSite();
16 sortList.value = await getClassifyList(); 16 sortList.value = await getClassifyList();
@@ -59,8 +59,9 @@ @@ -59,8 +59,9 @@
59 </template> 59 </template>
60 60
61 <script setup lang="ts"> 61 <script setup lang="ts">
  62 +import type { classifyType } from "~/api/types/classify";
62 import { ArrowRightBold, ArrowDownBold } from "@element-plus/icons-vue"; 63 import { ArrowRightBold, ArrowDownBold } from "@element-plus/icons-vue";
63 -const sortList = useState("sortTree"); 64 +const sortList = useState<classifyType[]>("sortTree");
64 // 激活的分类索引 65 // 激活的分类索引
65 const activeCategory = ref<number | null>(0); 66 const activeCategory = ref<number | null>(0);
66 const route = useRoute(); 67 const route = useRoute();
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="md:p-10 p-4 pt-0" style="min-height: calc(100vh - 320px)"> 2 <div class="md:p-10 p-4 pt-0" style="min-height: calc(100vh - 320px)">
3 <HomeRecommend 3 <HomeRecommend
4 :recommendList="list" 4 :recommendList="list"
5 - :navTitle="findLabelByAlias(name as string, sortList as any)" 5 + :navTitle="findLabelByAlias(name as string, sortList)"
6 navIcon="tag" 6 navIcon="tag"
7 /> 7 />
8 <el-pagination 8 <el-pagination
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 import type { appType } from "~/api/types/app"; 21 import type { appType } from "~/api/types/app";
22 import { getAppList } from "~/api/app"; 22 import { getAppList } from "~/api/app";
23 import type { classifyType } from "~/api/types/classify"; 23 import type { classifyType } from "~/api/types/classify";
24 -const sortList = useState<classifyType>("sortTree"); 24 +const sortList = useState<classifyType[]>("sortTree");
25 const route = useRoute(); 25 const route = useRoute();
26 const router = useRouter(); 26 const router = useRouter();
27 const { name } = route.params; 27 const { name } = route.params;
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <!-- 推荐工具区 --> 3 <!-- 推荐工具区 -->
4 <HomeRecommend 4 <HomeRecommend
5 :recommendList="list" 5 :recommendList="list"
6 - :navTitle="findLabelByAlias(name as string, sortList as any)" 6 + :navTitle="findLabelByAlias(name as string, sortList)"
7 navIcon="tag" 7 navIcon="tag"
8 :navTitleWidth="120.5" 8 :navTitleWidth="120.5"
9 /> 9 />
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 import type { appType } from "~/api/types/app"; 23 import type { appType } from "~/api/types/app";
24 import { getAppList } from "~/api/app"; 24 import { getAppList } from "~/api/app";
25 import type { classifyType } from "~/api/types/classify"; 25 import type { classifyType } from "~/api/types/classify";
26 -const sortList = useState<classifyType>("sortTree"); 26 +const sortList = useState<classifyType[]>("sortTree");
27 const route = useRoute(); 27 const route = useRoute();
28 const router = useRouter(); 28 const router = useRouter();
29 const { pageNum, name } = route.params; 29 const { pageNum, name } = route.params;