|
|
@ -1,7 +1,21 @@
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let messageDom: any = null;
|
|
|
|
|
|
|
|
const messageTypes: Array<string> = ['success', 'error', 'warning', 'info'];
|
|
|
|
|
|
|
|
const Message: any = (options) => {
|
|
|
|
|
|
|
|
if (messageDom) messageDom.close();
|
|
|
|
|
|
|
|
messageDom = ElMessage(options);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
messageTypes.forEach((type) => {
|
|
|
|
|
|
|
|
Message[type] = (options) => {
|
|
|
|
|
|
|
|
if (typeof options === 'string') options = { message: options };
|
|
|
|
|
|
|
|
options.type = type;
|
|
|
|
|
|
|
|
return Message(options);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export const MsgSuccess = (message) => {
|
|
|
|
export const MsgSuccess = (message) => {
|
|
|
|
ElMessage.success({
|
|
|
|
Message.success({
|
|
|
|
message: message,
|
|
|
|
message: message,
|
|
|
|
type: 'success',
|
|
|
|
type: 'success',
|
|
|
|
showClose: true,
|
|
|
|
showClose: true,
|
|
|
@ -10,7 +24,7 @@ export const MsgSuccess = (message) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const MsgInfo = (message) => {
|
|
|
|
export const MsgInfo = (message) => {
|
|
|
|
ElMessage.info({
|
|
|
|
Message.info({
|
|
|
|
message: message,
|
|
|
|
message: message,
|
|
|
|
type: 'info',
|
|
|
|
type: 'info',
|
|
|
|
showClose: true,
|
|
|
|
showClose: true,
|
|
|
@ -19,7 +33,7 @@ export const MsgInfo = (message) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const MsgWarning = (message) => {
|
|
|
|
export const MsgWarning = (message) => {
|
|
|
|
ElMessage.warning({
|
|
|
|
Message.warning({
|
|
|
|
message: message,
|
|
|
|
message: message,
|
|
|
|
type: 'warning',
|
|
|
|
type: 'warning',
|
|
|
|
showClose: true,
|
|
|
|
showClose: true,
|
|
|
@ -28,7 +42,7 @@ export const MsgWarning = (message) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export const MsgError = (message) => {
|
|
|
|
export const MsgError = (message) => {
|
|
|
|
ElMessage.error({
|
|
|
|
Message.error({
|
|
|
|
message: message,
|
|
|
|
message: message,
|
|
|
|
type: 'error',
|
|
|
|
type: 'error',
|
|
|
|
showClose: true,
|
|
|
|
showClose: true,
|
|
|
|