perf: 移除 @pureadmin/components , 打包大小未启用压缩前减少 0.48 MB , 首屏请求减少 2.3 MB 的资源,请务必升级哦

This commit is contained in:
xiaoxian521
2022-11-26 21:23:43 +08:00
parent 6110be29a1
commit b5f0ca52ce
8 changed files with 60 additions and 100 deletions

33
src/utils/message.ts Normal file
View File

@@ -0,0 +1,33 @@
import { type MessageHandler, ElMessage } from "element-plus";
// 更多配置请看https://element-plus.org/zh-CN/component/message.html#message-%E9%85%8D%E7%BD%AE%E9%A1%B9
type messageTypes = "success" | "info" | "warning" | "error";
/**
* `element-plus` 的 `info` 消息类型
*/
const message = (
message: string,
type = "info" as messageTypes,
showClose = true,
duration = 2000,
center = false,
grouping = false
): MessageHandler => {
return ElMessage({
message,
type,
showClose,
duration,
center,
grouping
});
};
/**
* 关闭 `element-plus` 的所有消息实例
*/
const closeAllMessage = (): void => ElMessage.closeAll();
export { message, closeAllMessage };