export default function install(Vue) {
if (install.installed) return;
install.installed = true;
//提示实例方法
Vue.prototype.tips = function(text = ‘’, type = ‘info’, time = 2000) {
console.log(text)
try {
this.$message({
type: type,
message: text,
duration: time
});
} catch (err) {
console.debug(err, ‘err’);
}
};
//loading缓存加载显示实例
Vue.prototype.loading = {
show(txt = ‘Loading’) {
this.loading = Vue.prototype.$loading({
lock: true,
text: txt,
spinner: ‘el-icon-loading’,
background: ‘rgba(0, 0, 0, 0.7)’
});
},
hide() {
this.loading.close()
}
};
}