Vue.js 为什么在img、vuejs中使用v-for时旋转木马不工作?
我当前正在使用以下库: 结果表明,在转盘内部使用v-for img时,转盘无法正常工作 这样就不起作用了:Vue.js 为什么在img、vuejs中使用v-for时旋转木马不工作?,vue.js,owl-carousel,Vue.js,Owl Carousel,我当前正在使用以下库: 结果表明,在转盘内部使用v-for img时,转盘无法正常工作 这样就不起作用了: <carousel :autoplay="true" :loop="true" :center="true" :nav="false" :margin="5" > <img v-for="item in detIncidente.fotos" :key="item.fecha" :src="item.pa
<carousel
:autoplay="true"
:loop="true"
:center="true"
:nav="false"
:margin="5"
>
<img
v-for="item in detIncidente.fotos"
:key="item.fecha"
:src="item.path"
width="446"
height="446"
@click="showSingle(item.path)"
/>
</carousel>
这样,如果它对我正确工作:
<carousel
:autoplay="true"
:loop="true"
:center="true"
:nav="false"
:margin="5"
>
<img width="446" height="669" src="https://placeimg.com/200/200/any?3" />
<img width="446" height="669" src="https://placeimg.com/200/200/any?4" />
<img width="446" height="669" src="https://placeimg.com/200/200/any?2" />
<img width="446" height="669" src="https://placeimg.com/200/200/any?3" />
</carousel>
如果动态加载图像,旋转木马组件不会等待数据加载 您可以尝试添加
v-if
v-if="detIncidente && detIncidente.fotos && detIncidente.fotos.length"
完整代码
<carousel
v-if="detIncidente && detIncidente.fotos && detIncidente.fotos.length"
:autoplay="true"
:loop="true"
:center="true"
:nav="false"
:margin="5"
>
<img
v-for="item in detIncidente.fotos"
:key="item.fecha"
:src="item.path"
width="446"
height="446"
@click="showSingle(item.path)"
/>
</carousel>
如果动态加载图像,旋转木马组件不会等待数据加载 您可以尝试添加
v-if
v-if="detIncidente && detIncidente.fotos && detIncidente.fotos.length"
完整代码
<carousel
v-if="detIncidente && detIncidente.fotos && detIncidente.fotos.length"
:autoplay="true"
:loop="true"
:center="true"
:nav="false"
:margin="5"
>
<img
v-for="item in detIncidente.fotos"
:key="item.fecha"
:src="item.path"
width="446"
height="446"
@click="showSingle(item.path)"
/>
</carousel>
非常感谢,这对我很有效,持续了好几天。非常感谢,这对我很有效,持续了好几天。