为什么iconlist刷新后会先显示第二页(只有一个图标)
来源:7-10 Vue项目首页 - 首页父子组组件间传值
慕妹4365742
2020-04-20
刷新后先显示的是一日游那一页,而不是第一页,其它没有任何问题,这是为什么
2回答
-
慕妹4365742
提问者
2020-04-21
补充我的代码:
<template>
<div class="wrapped">
<swiper class="swiper" :options="swiperOption" v-if="ifshow">
<swiper-slide v-for="item of swiperlist" :key="item.id">
<img class="swiper-img" :src="item.imgUrl" />
</swiper-slide>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</div>
</template>
<script>
export default {
name: 'HomeSwiper',
props: {
swiperlist: Array
},
data () {
return {
swiperOption: {
autoplay: 4000,
pagination: '.swiper-pagination',
paginationClickable: true,
loop: true
}// ssl: this.swiperlist
}
},
computed: {
ifshow () {
return this.swiperlist.length
}
}
/* watch: {
swiperlist: function (val) {
this.ssl = val
for (let i = 0; i < this.ssl.length; i++) {
let url = this.ssl[i].url
console.log('1')
this.ssl[i].url = require(`${url}`)
}
return this.ssl
}
} */
}
</script>
<style scoped>
@import '~styles/varibles.styl'
.wrapped >>> .swiper-pagination-bullet-active
background-color : #fff
.wrapped
overflow: hidden
width: 100%
height: 33%vw
background-color: red
.swiper
height: 100%
width: 100%
.swiper-img
margin: 0 auto
width: 100%
height: 100%
</style>
00 -
Dell
2020-04-21
同学你这块的代码发我看一下
062020-09-20
相似问题