如上图所示
在点击某个电话号码时,整个新父级全有选中效果,我期望的是只有电话那一行出现。
比如点了交通事帮122那一行,只是那一行显示选中效果。而不是整块。
代码如下:
< block wx:for-items = "{{list}}" > < view class = "widgets__item" > <!--类别 --> < view id = "{{item.id}}" class = "widgets__info {{item.open ? 'widgets__info_show' : ''}}" bindtap = "widgetsToggle" > < text class = "widgets__info-name" >{{item.name}}</ text > < image class = "widgets__info-img" src = "../images/arrowright.png" mode = "aspectFill" /> </ view > <!--类别下所有黄页电话 --> < view class = "widgets__list {{item.open ? 'widgets__list_show' : ''}}" > < block wx:for-items = "{{item.subName}}" wx:for-item = "name" > < view class = "widget" bindtap = "callPhone" data-phone = "{{item.phone[index]}}" hover-start-time = "10" hover-stay-time = "100" > <!--黄页客户 --> < text class = "widget__name" data-phone = "{{item.phone[index]}}" >{{name}}</ text > <!--电话 --> < text class = "phoneText" data-phone = "{{item.phone[index]}}" >{{item.phone[index]}}</ text > </ view > </ block > </ view > </ view > </ block > |
text外面再套一个view,给这个view绑定事件
给到view的好处是点击一行的任何地址,都可以响应。
而给到text只有点到电话才响应。
所以觉得给到view整行更好一些。
callPhone事件单独给text嘛