the part of swiper is v-for, but it only works for the swiper of the first option, and the swiper of other loops does not work. How to solve this problem?
<template>
<div class="content clearfix">
<div class="leftBar leftHelpBar">
<ul class="leftHelp_tab clearfix">
<li v-for="(item, tabIndex) in items" :class="{onCur: iscur == tabIndex}" @click="setCur(tabIndex)" :key="tabIndex">{{ item.name }}</li>
</ul>
<ul class="help_list" v-for="(item, i) in items" :key="i" v-show="iscur == i">
<li v-for="(item, index) in item.dataList" :key="index">
<h3>{{ item.title }}</h3>
<span v-for="(item, subIndex) in item.content"
:key="subIndex"
:class="{curStyle: `${i},${index},${subIndex}`== getcur}"
@click="postCur(`${i},${index},${subIndex}`)">
{{ item.subTit }}
</span>
</li>
</ul>
</div>
<div class="rightBar">
<div v-for="(item, i) in items" :key="i" class="help-img-con">
<div v-for="(item, index) in item.dataList" :key="index">
<div v-for="(item, subIndex) in item.content"
:key="subIndex"
v-show="`${i},${index},${subIndex}`== getcur"
v-swiper:mySwiper="swiperOption"
ref="mySwiper"
:options="swiperOption">
<ul class="swiper-wrapper">
<li v-for="(item, k) in item.img" :key="k" class="help-img-list swiper-slide">
<img :src="item.imgsrc" alt="" />
</li>
</ul>
<div class="swiper-button-next" slot="button-next"></div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
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
}
}
}
</script>
the first option is valid