feat: 全局crud的ElNotification提示,ElNotification的封装

This commit is contained in:
H0nGzA1
2023-04-21 20:49:48 +08:00
parent 054bcf3eea
commit 25cc2c83c1
2 changed files with 27 additions and 2 deletions

View File

@@ -1,10 +1,10 @@
import { ElMessage, MessageOptions } from 'element-plus';
import { ElMessage, ElNotification, MessageOptions } from 'element-plus';
export function message(message: string, option?: MessageOptions) {
ElMessage({ message, ...option });
}
export function successMessage(message: string, option?: MessageOptions) {
ElMessage({ message, ...option, type: 'success' });
ElMessage({ message, type: 'success' });
}
export function warningMessage(message: string, option?: MessageOptions) {
ElMessage({ message, ...option, type: 'warning' });
@@ -15,3 +15,19 @@ export function errorMessage(message: string, option?: MessageOptions) {
export function infoMessage(message: string, option?: MessageOptions) {
ElMessage({ message, ...option, type: 'info' });
}
export function notification(message: string) {
ElNotification({ message });
}
export function successNotification(message: string) {
ElNotification({ message, type: 'success' });
}
export function warningNotification(message: string) {
ElNotification({ message, type: 'warning' });
}
export function errorNotification(message: string) {
ElNotification({ message, type: 'error' });
}
export function infoNotification(message: string) {
ElNotification({ message, type: 'info' });
}