fixed #1063
This commit is contained in:
parent
300bd6623e
commit
297648f1e6
9 changed files with 180 additions and 33 deletions
|
@ -1,2 +1,33 @@
|
|||
import Spin from './spin.vue';
|
||||
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;
|
Loading…
Add table
Add a link
Reference in a new issue