completed create all filters type
This commit is contained in:
24
src/stores/filters.ts
Normal file
24
src/stores/filters.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { dispatchNotification } from '@/components/Notification'
|
||||
import { readData, removeData, writeData } from '@/utils/storage'
|
||||
import router from '@/router'
|
||||
|
||||
export const useFiltersStore = defineStore('filters', () => {
|
||||
const config = ref({
|
||||
reportButton: false,
|
||||
type: 'type-1'
|
||||
})
|
||||
|
||||
const setConfig = (test: {reportButton: boolean, type: string}) => {
|
||||
config.value = {
|
||||
reportButton: test.reportButton,
|
||||
type: test.type
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
config,
|
||||
setConfig
|
||||
}
|
||||
})
|
@ -6,8 +6,10 @@ import { routes } from '@/router'
|
||||
import type { MenuItemModel } from '@/types/menu'
|
||||
import { splitRoutePath } from '@/utils/texts'
|
||||
import { useCommandPalattesStore } from '@/stores/command'
|
||||
import { useFiltersStore } from './filters'
|
||||
|
||||
export const useMenuStore = defineStore('menu', () => {
|
||||
const filters = useFiltersStore()
|
||||
const route = useRoute()
|
||||
const navigation = ref<MenuItemModel[]>([])
|
||||
const sidebarOpen = ref(false)
|
||||
@ -56,11 +58,16 @@ export const useMenuStore = defineStore('menu', () => {
|
||||
}
|
||||
} else {
|
||||
collapseAllMenu()
|
||||
|
||||
filters.setConfig({
|
||||
type: '',
|
||||
reportButton: false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const expandCurrentActiveMenu = (): void => {
|
||||
const menuData = convertRouteToMenu(routes.at(0)?.children || [])
|
||||
const menuData = convertRouteToMenu(routes[0]?.children || [])
|
||||
navigation.value = menuData
|
||||
menuSelected.value = router.currentRoute.value.fullPath
|
||||
|
||||
|
Reference in New Issue
Block a user