middle-admin-ant/src/application/mk/libs/function/modal.js

64 lines
1.6 KiB
JavaScript

import VXETable from 'vxe-table'
/**
* 函数 - 弹窗
*/
const msgs = { // 提示信息
title: "提示",
confirmText: "确定",
cancelText: "取消",
placeholderText: "请输入"
};
export default {
/**
this.$mk.alert({ content: '基本提示框', title: '标题1' });
*/
alert: function (options = {}) { // 弹窗
options = Object.assign({ title: msgs.title }, options); // 合并
return VXETable.modal.alert(options); // 弹窗
},
/**
this.$mk.msg(“消息提示”);
*/
msg: function (content) {
return VXETable.modal.message({ content: content }); // 消息提示
},
info: function (content) { // 信息提示
return VXETable.modal.message({ content: content, status: 'info' });
},
warning: function (content) { // 警告提示
return VXETable.modal.message({ content: content, status: 'warning' });
},
question: function (content) { // 询问提示
return VXETable.modal.message({ content: content, status: 'question' });
},
success: function (content) { // 成功提示
return VXETable.modal.message({ content: content, status: 'success' });
},
error: function (content) { // 错误提示
return VXETable.modal.message({ content: content, status: 'error' });
},
loading: function (content) { // 加载提示
return VXETable.modal.message({ content: content, status: 'loading', duration: -1, id: 'loading' });
},
hideLoading: function () { // 隐藏加载提示
VXETable.modal.close("loading");
},
/*
this.$mk.confirm('您确定要删除吗?').then(type => {
this.$mk.msg("点击了确定")
});
*/
confirm: VXETable.modal.confirm // 确认提示
}