Update SlideAlbum.vue

修复加载后无法获取div[@class='img-slide-list']宽度导致无法滑动的问题
This commit is contained in:
zhongke-wang 2023-11-07 14:26:52 +08:00 committed by GitHub
parent adf195a189
commit 7ae987109c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,7 @@
import enums from "../../utils/enums"; import enums from "../../utils/enums";
import Utils from '../../utils' import Utils from '../../utils'
import {mat4} from 'gl-matrix' import {mat4} from 'gl-matrix'
import {onMounted, onBeforeUpdate, reactive, ref, watch, computed, provide} from "vue"; import {onMounted, onBeforeUpdate, reactive, ref, watch, computed, provide, nextTick} from "vue";
import { import {
getSlideDistance, getSlideDistance,
slideInit, slideInit,
@ -239,7 +239,9 @@ const state = reactive({
localItem: props.item, localItem: props.item,
}) })
onMounted(() => { onMounted(async () => {
await nextTick();
slideInit(wrapperEl.value, state, SlideType.HORIZONTAL) slideInit(wrapperEl.value, state, SlideType.HORIZONTAL)
state.cycleFn = () => { state.cycleFn = () => {