refactor(frontend): 重构前端第二版
This commit is contained in:
1 parent
2631f78b00
commit
4b562cfa82
205 files changed
+15399
-12015
No files matched your search
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* shared/composables/useMessage.ts
|
||||
* 业务层消息助手,封装全局 LevelMessageDialog 调用。
|
||||
*/
|
||||
import { useGlobalMessageDialog } from './useGlobalMessageDialog';
|
||||
|
||||
type MessageTitle = string | undefined;
|
||||
|
||||
/**
|
||||
* 业务层消息助手:
|
||||
* - 统一复用全局 LevelMessageDialog
|
||||
* - 提供更短的方法名,减少重复传 level 字符串
|
||||
*/
|
||||
export const useMessage = () => {
|
||||
const { showMessageDialog } = useGlobalMessageDialog();
|
||||
|
||||
const info = (message: string, title?: MessageTitle) =>
|
||||
showMessageDialog('info', message, title);
|
||||
|
||||
const success = (message: string, title?: MessageTitle) =>
|
||||
showMessageDialog('success', message, title);
|
||||
|
||||
const warning = (message: string, title?: MessageTitle) =>
|
||||
showMessageDialog('warning', message, title);
|
||||
|
||||
// 兼容常见缩写调用:msg.warn(...)
|
||||
const warn = warning;
|
||||
|
||||
const error = (message: string, title?: MessageTitle) =>
|
||||
showMessageDialog('error', message, title);
|
||||
|
||||
return {
|
||||
info,
|
||||
success,
|
||||
warning,
|
||||
warn,
|
||||
error,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user