add tiptap
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import type { AppContext } from "vue";
|
||||
|
||||
type MessageType = "info" | "success" | "warning" | "error";
|
||||
|
||||
type MessageHandler = (content: string) => unknown | Promise<unknown>;
|
||||
|
||||
type MessageApi = {
|
||||
[type in MessageType]?: MessageHandler;
|
||||
};
|
||||
|
||||
export const showTDesignMessage = async (
|
||||
appContext: AppContext | undefined,
|
||||
type: MessageType,
|
||||
content: string
|
||||
) => {
|
||||
const handler = (appContext?.config.globalProperties.$message as MessageApi | undefined)?.[type];
|
||||
if (handler) {
|
||||
await handler(content);
|
||||
return;
|
||||
}
|
||||
if ("error" === type) {
|
||||
console.error(content);
|
||||
return;
|
||||
}
|
||||
console.warn(content);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user