import { Message, Loading, MessageBox } from 'element-ui';
引入时需要重定向
Vue.prototype.$loading = Loading.service;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$message = Message;
在页面调用
例:
this.$loading({
lock: true,
text: "Loading",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
})
this.$alert(msg, "温馨提示", {
confirmButtonText: "确定",
}).then(() => { })
this.$confirm(`我是一个提示语`, '温馨提示', {
confirmButtonText: '确定'
}).then(() => {
}).catch(() => {})