bklLiudl
2024-05-25 484e5129e4c9a671c5660a556a24bd306f1fdd9b
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
34
35
36
37
38
39
import LoadingBar from './loading-bar.vue';
import Vue from 'vue';
 
LoadingBar.newInstance = properties => {
    const _props = properties || {};
 
    const Instance = new Vue({
        data: _props,
        render (h) {
            return h(LoadingBar, {
                props: _props
            });
        }
    });
 
    const component = Instance.$mount();
    document.body.appendChild(component.$el);
    const loading_bar = Instance.$children[0];
 
    return {
        update (options) {
            if ('percent' in options) {
                loading_bar.percent = options.percent;
            }
            if (options.status) {
                loading_bar.status = options.status;
            }
            if ('show' in options) {
                loading_bar.show = options.show;
            }
        },
        component: loading_bar,
        destroy () {
            document.body.removeChild(document.getElementsByClassName('ivu-loading-bar')[0]);
        }
    };
};
 
export default LoadingBar;