// 新建eleui js
import { MessageBox } from 'element-ui';
const eleui = {
confirm(obj) {
var message = obj.message || '确定删除吗?'
var title = obj.title || '温馨提示'
return MessageBox.confirm(message, title, {
type: 'danger',
showCancelButton: obj.showCancelButton || true,
cancelButtonText: obj.cancelButtonText || '取消',
confirmButtonText: obj.confirmButtonText || '确定',
}).then(obj.success || function() {
}).catch(obj.fail || function() {
});
}
}
export default eleui
// mainjs导入
import eleui from './assets/js/eleui/eleui.js';
Vue.prototype.eleui = eleui
// 页面调用
this.eleui.confirm({
message: '确定修改吗?',
success: () => {
this.editWorkerInfo();
},
fail: () => {
this.query();
}
})
element-ui重新封装弹框
最新推荐文章于 2024-07-02 14:12:26 发布