旭钦科技
旭钦科技
  • 发布:2018-12-18 14:54
  • 更新:2018-12-18 15:43
  • 阅读:909

swiper【报Bug】

分类:uni-app

current变化,h5不不能跳转,小程序是正常的
代码如下:
<template>
<view>
<swiper :indicator-dots="true" :interval="1000" :duration="500" :current="xindex" style="height: 500px;">
<swiper-item v-for="(item, index) of timu_arr" :key="index" >
<view>
<view class="tigan">{{item.tigan}}{{xindex}}</view>
<view v-for="(t, x) of item.xuanxiang" :key="x" :class="['xuanxiang',t.active?'xuanxiang_active':'']" @click="xuanzhe(index,x)">
{{x+1}}:{{t.text}}
</view>
</view>
</swiper-item>
</swiper>
</view>
</template>

<script>
export default {
data() {
return {
xindex: 0,
timu_arr: [{
'tigan': '关于改革开放40年,你有什么最想说的?',
'xuanxiang': [{
'text': '我心情好',
'fenzhi': 1,
'active': false
},
{
'text': '我心情好',
'fenzhi': 1,
'active': false
},
{
'text': '我自豪,我高兴',
'fenzhi': 5,
'active': false
},
{
'text': '我心情好',
'fenzhi': 1,
'active': false
}, {
'text': '我心情好',
'fenzhi': 1,
'active': false
}
],
'jiexi': '自豪才是正常的',
'tmlx': '单选题',
'tmlxid': 1
},
{
'tigan': '关于19大报告最准确的?',
'xuanxiang': [{
'text': '我们是资本国家',
'fenzhi': 1,
'active': false
},
{
'text': '我心情好',
'fenzhi': 1,
'active': false
},
{
'text': '我自豪,我高兴',
'fenzhi': 1,
'active': false
},
{
'text': '继续改革开放',
'fenzhi': 5,
'active': false
}, {
'text': '我心情不好',
'fenzhi': 1,
'active': false
}
],
'jiexi': '继续改革开放才是正常的',
'tmlx': '多选题',
'tmlxid': 2
}
]
};
},
methods: {
xuanzhe: function(index, x) {
var that = this
var timu_arr = that.timu_arr
console.log(timu_arr[index].tmlxid)
if (timu_arr[index].tmlxid == 1) {
for (let i in timu_arr[index].xuanxiang) {
timu_arr[index].xuanxiang[i].active = false
}
}
timu_arr[index].xuanxiang[x].active = true
that.xindex = that.xindex + 1
console.log(timu_arr)
}
}
}
</script>

<style>
.xuanxiang {
padding: 10px 0px;
}

.xuanxiang_active {  
    background-color: #eee;  
}  

</style>

2018-12-18 14:54 负责人:无 分享
已邀请:
quitter

quitter - 此人很懒,没有留下介绍

我也遇到了这个问题 好烦额

  • 旭钦科技 (作者)

    最后解决了?

    2018-12-18 16:16

  • quitter

    没 还在找方法

    2018-12-18 17:58

该问题目前已经被锁定, 无法添加新回复