swiper的部分是v-for出来的,但是只对第一个选项的swiper生效,其他循环的swiper不生效,怎么解决这个问题?
- {{ item.name }}
{{ item.title }}
:key="subIndex"
:class="{curStyle: `${i},${index},${subIndex}`== getcur}"
@click="postCur(`${i},${index},${subIndex}`)">
{{ item.subTit }}
:key="subIndex"
v-show="`${i},${index},${subIndex}`== getcur"
v-swiper:mySwiper="swiperOption"
ref="mySwiper"
:options="swiperOption">
import axios from 'axios'
export default {
data () {
return {
iscur: 0,
getcur: '0,0,0',
swiperOption: {},
items: []
}
},
mounted: function () {
axios.get('static/data/leftHelpBase.json')
.then((res) => {
console.log(res)
this.items = res.data.dataInfo
})
.catch((err) => {
console.log(err)
})
},
methods: {
setCur: function (index) {
this.iscur = index
this.getcur = index + ',0,0'
},
postCur: function (index) {
this.getcur = index
}
},
computed: {
swiper () {
return this.$refs.mySwiper.swiper
}
}
}
第一个选项是生效的
其他的都不生效