Vue.component('common-loading', {
template: `
`,
props: {
'show': {
type: Boolean,
default: false,
},//是否显示
'message': {
type: String,
default: '',
},//提示文字
'loadingStyle': {
type: Object,
default: () => {
return {
ModalBgColor: 'rgba(0,0,0,0.5)',
messageColor: '#409EFF',
messageBgColor: '#ffffff',
}
},
},
},
data() {
return {
zIndex: 1,
}
},
methods: {
setZIndex() {
let zIndex = [...document.all].reduce((r, e) => Math.max(r, +window.getComputedStyle(e).zIndex || 0), 0);
console.log(zIndex);
this.zIndex = zIndex;
}
},
created() {
this.setZIndex();
},
watch: {
show(n) {
if (n) {
this.setZIndex();
}
}
}
});