forked from Mirrors/elk
fix(command): re-register when component activated
This commit is contained in:
parent
f1f2449559
commit
2332d7091a
1 changed files with 3 additions and 2 deletions
|
@ -208,10 +208,11 @@ export const useCommandRegistry = defineStore('command', () => {
|
|||
export const useCommand = (cmd: CommandProvider) => {
|
||||
const registry = useCommandRegistry()
|
||||
|
||||
registry.register(cmd)
|
||||
|
||||
const register = () => registry.register(cmd)
|
||||
const cleanup = () => registry.remove(cmd)
|
||||
|
||||
register()
|
||||
onActivated(register)
|
||||
onDeactivated(cleanup)
|
||||
tryOnScopeDispose(cleanup)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue