第一步,创建一个 messageTips.js 文件
export const success = that => that.$message({
message: '恭喜你,这是一条成功的消息',
type: 'success'
})
export const warning = that => that.$message({
message: '對不起,這是一條警告信息',
type: 'warning'
})
第二步,在需要的组件中
import { success, warning } from "@/api/messageTips.js";
第三步,直接使用
warning(this);
success(this);
网友评论