新增前端vue

This commit is contained in:
2025-11-26 13:55:01 +08:00
parent ae391f1b94
commit ffd5a6ad66
781 changed files with 83348 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
/**
* 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 type { RouteLocationNormalized } from 'vue-router';
import { getRawRoute } from '@jeesite/core/utils';
import { mitt } from '@jeesite/core/utils/mitt';
const emitter = mitt<{
[key]: RouteLocationNormalized;
}>();
const key = Symbol();
let lastChangeTab: RouteLocationNormalized;
export function setRouteChange(lastChangeRoute: RouteLocationNormalized) {
const r = getRawRoute(lastChangeRoute);
emitter.emit(key, r);
lastChangeTab = r;
}
export function listenerRouteChange(callback: (route: RouteLocationNormalized) => void, immediate = true) {
emitter.on(key, callback);
immediate && lastChangeTab && callback(lastChangeTab);
}
export function removeTabChangeListener() {
emitter.clear();
}