AI弹窗
This commit is contained in:
48
src/utils/toast.js
Normal file
48
src/utils/toast.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
/**
|
||||
* 显示Toast消息
|
||||
* @param {string} message - 消息内容
|
||||
* @param {string} type - 消息类型: 'success', 'warning', 'info', 'error'
|
||||
* @param {number} duration - 显示时长,默认3000ms
|
||||
*/
|
||||
export function showToast(message, type = 'info', duration = 3000) {
|
||||
Message({
|
||||
message,
|
||||
type,
|
||||
duration,
|
||||
showClose: true
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示成功消息
|
||||
* @param {string} message - 消息内容
|
||||
*/
|
||||
export function showSuccess(message) {
|
||||
showToast(message, 'success')
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示错误消息
|
||||
* @param {string} message - 消息内容
|
||||
*/
|
||||
export function showError(message) {
|
||||
showToast(message, 'error')
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示警告消息
|
||||
* @param {string} message - 消息内容
|
||||
*/
|
||||
export function showWarning(message) {
|
||||
showToast(message, 'warning')
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示信息消息
|
||||
* @param {string} message - 消息内容
|
||||
*/
|
||||
export function showInfo(message) {
|
||||
showToast(message, 'info')
|
||||
}
|
||||
Reference in New Issue
Block a user