middleground_code_v2/src/utils/loading.js

43 lines
901 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {
Loading
} from 'element-ui'
let appLoading
export function openLoading(loadingName) {
let loadingText
switch (loadingName) {
case 'submit':
loadingText = '提交'
break;
case 'detail':
loadingText = '获取详情'
break;
case 'down':
loadingText = '下载'
break;
case 'upload':
loadingText = '上传附件'
break;
case 'del':
loadingText = '删除'
break;
case 'test':
loadingText = '校验数据'
break;
}
appLoading = Loading.service({
text: "正在" + loadingText + ",请稍候",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
customClass: 'loadingclass',// **遮罩层新增类名如果需要修改loading的样式**
})
setTimeout(() => {
appLoading.close();
}, 10000)
}
export function closeLoading() {
if (appLoading) {
appLoading.close();
}
}