parent
ee754d3533
commit
1eb837e9a1
1 changed files with 22 additions and 13 deletions
|
@ -40,7 +40,8 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
gridInnerStyle: {}
|
gridInnerStyle: {},
|
||||||
|
sizeWaiting: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -59,20 +60,28 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
size() {
|
size() {
|
||||||
// for Safari bug
|
// for Safari bug
|
||||||
if (this.$refs.gridOuter) {
|
if (this.sizeWaiting) return;
|
||||||
let height = 287;
|
|
||||||
const parent = this.$props.parentElement || this.$parent.$el;
|
|
||||||
|
|
||||||
if (this.$refs.gridOuter.clientHeight) {
|
this.sizeWaiting = true;
|
||||||
height = this.$refs.gridOuter.clientHeight;
|
|
||||||
} else if (parent) {
|
window.requestAnimationFrame(() => {
|
||||||
height = parent.getBoundingClientRect().width * 9 / 16;
|
this.sizeWaiting = false;
|
||||||
|
|
||||||
|
if (this.$refs.gridOuter) {
|
||||||
|
let height = 287;
|
||||||
|
const parent = this.$props.parentElement || this.$parent.$el;
|
||||||
|
|
||||||
|
if (this.$refs.gridOuter.clientHeight) {
|
||||||
|
height = this.$refs.gridOuter.clientHeight;
|
||||||
|
} else if (parent) {
|
||||||
|
height = parent.getBoundingClientRect().width * 9 / 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.gridInnerStyle = { height: `${height}px` };
|
||||||
|
} else {
|
||||||
|
this.gridInnerStyle = {};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
this.gridInnerStyle = { height: `${height}px` };
|
|
||||||
} else {
|
|
||||||
this.gridInnerStyle = {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue