Files
xj-admin/src/logics/mitt/mixTopClick.ts
T
2025-06-27 17:42:38 +08:00

22 lines
584 B
TypeScript

/**
* Used to monitor routing changes to change the status of menus and tabs. There is no need to monitor the route, because the route status change is affected by the page rendering time, which will be slow
*/
import mitt from '/@/utils/mitt';
import type { Menu } from '/@/router/types';
const emitter = mitt();
const key = Symbol();
export function setMixTopClick(menu: Menu) {
emitter.emit(key, menu);
}
export function listenerMixTopClick(callback: (menu: Menu) => void) {
emitter.on(key, callback);
}
export function removeMixTopClick() {
emitter.off(key);
}