fix(Image): loading placeholder not work

This commit is contained in:
chenjiahan
2020-08-26 16:24:02 +08:00
parent eb0cc05b12
commit c720eea831
6 changed files with 14 additions and 15 deletions
+4 -4
View File
@@ -24,12 +24,12 @@ export default createComponent({
},
setup(props) {
const rootRef = ref(null);
const pivotRef = ref(null);
const rootRef = ref();
const pivotRef = ref();
const state = reactive({
pivotWidth: 0,
rootWidth: 0,
pivotWidth: 0,
});
const background = computed(() =>
@@ -38,8 +38,8 @@ export default createComponent({
const setWidth = () => {
nextTick(() => {
state.pivotWidth = pivotRef.value ? pivotRef.value.offsetWidth : 0;
state.rootWidth = rootRef.value.offsetWidth;
state.pivotWidth = pivotRef.value ? pivotRef.value.offsetWidth : 0;
});
};