mirror of https://github.com/ElemeFE/element
loading directive customClass
parent
81ff11ad41
commit
735a834566
|
@ -76,6 +76,7 @@ exports.install = Vue => {
|
||||||
const textExr = el.getAttribute('element-loading-text');
|
const textExr = el.getAttribute('element-loading-text');
|
||||||
const spinnerExr = el.getAttribute('element-loading-spinner');
|
const spinnerExr = el.getAttribute('element-loading-spinner');
|
||||||
const backgroundExr = el.getAttribute('element-loading-background');
|
const backgroundExr = el.getAttribute('element-loading-background');
|
||||||
|
const customClassExr = el.getAttribute('element-loading-custom-class');
|
||||||
const vm = vnode.context;
|
const vm = vnode.context;
|
||||||
const mask = new Mask({
|
const mask = new Mask({
|
||||||
el: document.createElement('div'),
|
el: document.createElement('div'),
|
||||||
|
@ -83,6 +84,7 @@ exports.install = Vue => {
|
||||||
text: vm && vm[textExr] || textExr,
|
text: vm && vm[textExr] || textExr,
|
||||||
spinner: vm && vm[spinnerExr] || spinnerExr,
|
spinner: vm && vm[spinnerExr] || spinnerExr,
|
||||||
background: vm && vm[backgroundExr] || backgroundExr,
|
background: vm && vm[backgroundExr] || backgroundExr,
|
||||||
|
customClass: vm && vm[customClassExr] || customClassExr,
|
||||||
fullscreen: !!binding.modifiers.fullscreen
|
fullscreen: !!binding.modifiers.fullscreen
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -171,6 +171,25 @@ describe('Loading', () => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('customClass', done => {
|
||||||
|
vm = createVue({
|
||||||
|
template: `
|
||||||
|
<div v-loading="loading" element-loading-custom-class="loading-custom-class"></div>
|
||||||
|
`,
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
Vue.nextTick(() => {
|
||||||
|
const mask = document.querySelector('.el-loading-mask');
|
||||||
|
expect(mask.classList.contains('loading-custom-class')).to.true;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as a service', () => {
|
describe('as a service', () => {
|
||||||
|
@ -253,5 +272,11 @@ describe('Loading', () => {
|
||||||
expect(text).to.exist;
|
expect(text).to.exist;
|
||||||
expect(text.textContent).to.equal('Loading...');
|
expect(text.textContent).to.equal('Loading...');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('customClass', () => {
|
||||||
|
loadingInstance = Loading({ customClass: 'el-loading-custom-class' });
|
||||||
|
const customClass = document.querySelector('.el-loading-custom-class');
|
||||||
|
expect(customClass).to.exist;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue