[add] 同步前端代码

This commit is contained in:
lcj
2025-06-24 10:44:10 +08:00
parent 0edd267f78
commit 8bf9f47d62
1841 changed files with 2445804 additions and 0 deletions

22
plus-ui/src/utils/bus.ts Normal file
View File

@ -0,0 +1,22 @@
import mitt from 'mitt';
const emitter = mitt();
export default {
install(app) {
// 发送事件
app.config.globalProperties.$sendChanel = (event, payload) => {
emitter.emit(event, payload);
};
// 监听事件(返回取消函数)
app.config.globalProperties.$recvChanel = (event, handler) => {
emitter.on(event, handler);
// 可选:返回解绑函数,方便使用
return () => {
emitter.off(event, handler);
};
};
}
};