export default function install(Vue) {
/**
* 警告提示
*/
Vue.prototype.alert = function (options = {}) {
options = {
message: options.message || '确认当前操作?',
title: options.title || '提示',
thenFun: options.thenFun || '',
confirmButtonText: options.confirmButtonText || '确定',
// buttonCan: options.buttonCan || '取消'
}
this.$alert(options.message, options.title, {
confirmButtonText: options.confirmButtonText,
callback: action => options.thenFun(action)
})
}
Vue.prototype.sucMeassage = function (msg) {
this.$message({
message: msg,
type: 'success'
});
}
// 可输入弹窗
Vue.prototype.input = function (options = {}) {
options = {
message: options.message || '请输入',
title: options.title || '提示',
thenFun: options.thenFun || '',
confirmButtonText: options.confirmButtonText || '确定',
cancelButtonText: options.cancelButtonText || '取消'
}
this.$prompt(options.message, '提示', {
confirmButtonText: options.confirmButtonText,
cancelButtonText: options.cancelButtonText,
}).then(({ value }) => {
options.thenFun(value)
}).catch(() => {})
}
}