update command
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import { useRouter, type RouteRecordRaw } from 'vue-router'
|
||||
import { readDataJson, writeDataJson } from '@/utils/storage'
|
||||
import { extractLeafRoutes } from '@/router'
|
||||
import { useMenuStore } from '@/stores/menu'
|
||||
|
||||
export const useCommandPalattesStore = defineStore('command_palettes', () => {
|
||||
const open = ref(false)
|
||||
|
||||
const route = useRouter()
|
||||
const menu = useMenuStore()
|
||||
const controlStatus = ref(false)
|
||||
const keyFStatus = ref(false)
|
||||
|
||||
@ -82,6 +84,16 @@ export const useCommandPalattesStore = defineStore('command_palettes', () => {
|
||||
return matchingRoutes
|
||||
}
|
||||
|
||||
const openMenu = (routeTarget: RouteRecordRaw) => {
|
||||
addRecent(routeTarget)
|
||||
route.push(routeTarget.path)
|
||||
closeCommand()
|
||||
}
|
||||
|
||||
const closeCommand = () => {
|
||||
open.value = false
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
showCommandPalettes,
|
||||
@ -91,6 +103,8 @@ export const useCommandPalattesStore = defineStore('command_palettes', () => {
|
||||
addRecent,
|
||||
readRecent,
|
||||
searchRoutesByName,
|
||||
searchRoutesPath
|
||||
searchRoutesPath,
|
||||
openMenu,
|
||||
closeCommand
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user