refactor: rename categories to defaultCategories and initialize categories from it

v3.2
CaptainB 2025-09-29 15:34:30 +08:00
parent d1fd625972
commit 408e79ff12
1 changed files with 4 additions and 2 deletions

View File

@ -128,8 +128,7 @@ const loading = ref(false)
const searchValue = ref('') const searchValue = ref('')
const folderId = ref('') const folderId = ref('')
const toolType = ref('INTERNAL') const toolType = ref('INTERNAL')
const defaultCategories = ref<ToolCategory[]>([
const categories = ref<ToolCategory[]>([
// //
// { // {
// id: 'recommend', // id: 'recommend',
@ -162,6 +161,8 @@ const categories = ref<ToolCategory[]>([
// tools: [] // tools: []
// } // }
]) ])
const categories = ref<ToolCategory[]>([...defaultCategories.value])
const filterList = ref<any>(null) const filterList = ref<any>(null)
function getSubTitle(tool: any) { function getSubTitle(tool: any) {
@ -188,6 +189,7 @@ async function getList() {
async function getInternalToolList() { async function getInternalToolList() {
try { try {
categories.value = defaultCategories.value
const res = await ToolStoreApi.getInternalToolList({ name: searchValue.value }, loading) const res = await ToolStoreApi.getInternalToolList({ name: searchValue.value }, loading)
if (searchValue.value.length) { if (searchValue.value.length) {
filterList.value = res.data filterList.value = res.data