bklLiudl
2025-04-07 4e8f58cb41c7b6d570fd1979d80f74ab8a4d00c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Spin from './spin.js';
 
let spinInstance;
 
function getSpinInstance (render = undefined) {
    spinInstance = spinInstance || Spin.newInstance({
        render: render
    });
 
    return spinInstance;
}
 
function loading (options) {
    const render = ('render' in options) ? options.render : undefined;
    let instance  = getSpinInstance(render);
 
    instance.show(options);
}
 
Spin.show = function (props = {}) {
    return loading(props);
};
Spin.hide = function () {
    if (!spinInstance) return false;
 
    const instance = getSpinInstance();
 
    instance.remove(() => {
        spinInstance = null;
    });
};
 
export default Spin;