globalLoading

This commit is contained in:
bwcx_jzy 2022-01-06 14:31:39 +08:00
parent d442d176a5
commit 39a8486fd6
No known key found for this signature in database
GPG Key ID: 5E48E9372088B9E5

View File

@ -36,6 +36,16 @@ Vue.prototype.$setLoading = function (props) {
} else if (Object.prototype.toString.call(props) !== "[object Object]") {
props = {};
}
// 计数
const loadingCount = this.$app.globalLoadingProps.loadingCount || 0;
if (props.spinning) {
props.loadingCount = loadingCount + 1;
} else {
props.loadingCount = loadingCount - 1;
props.loadingCount = Math.max(props.loadingCount, 0);
props.spinning = props.loadingCount > 0;
}
//console.log(props);
props.wrapperClassName = props.spinning ? "globalLoading" : "";
this.$app.globalLoadingProps = { ...this.$app.globalLoadingProps, ...props };
};