如图,,点击选中,选中的框变色,其他不变,可以来回切换

发布于 7 年前作者 pingliao3105 次浏览最后编辑 7 年前来自 ask

请问怎么实现?求大神赐教,最好有demo,在线等,急用

7 回复
dcui
dcui1 楼6 年前

点击事件的index,用index来控制选中的样式

weilong
weilong2 楼6 年前

<block wx:for=“{{house.imgs}}” wx:key=“{{index}}”>

<image class=“{{item == selectImg?‘’:‘noselect’}}” style=“width:145rpx;height:94rpx;” mode=“aspectFill” bindtap=“selectImg” id=“{{index}}” src=“{{item}}”/>

</block>

// 选择图片显示

selectImg:function(e){

var that = this,

imgId = e.currentTarget.id

that.setData({

selectImg: that.data.house.imgs[imgId],

selectVideo:“”

})

},

motao
motao3 楼6 年前

changeColor:that.data.mblist[i].name

item.name == changeColor

wanyan
wanyan4 楼6 年前

样式写了,不知道咋切换?用三目运算符,一直没效果,请问具体怎么做?

wei38
wei385 楼6 年前

写两个样式,一个是红色边框,一个无边框,动态切换样式就行了

jiesu
jiesu6 楼6 年前

请问是在wxml里面判断,还是在js里判断?有代码吗,粘出来看看,谢谢!

xfang
xfang7 楼5 年前

哪位知道,请告知一下