自定义组件点击更新数据后样式失效
实现一个自定义的筛选框,打开后效果如下

点击左侧三个选项后变为

wxml结构以及样式如下

失效标签处渲染的样式如下

-----------------------------------------------已解决--------------------------------------------------------
之前的代码结构如下
< block wx:for = "{{filter}}" wx:key = "index" wx:item = "item" > < text class = "filter-item {{item.asc ? 'filter-item--asc' : ''}}" data-index = "{{index}}" bind:tap = "filterItemTap" >{{item.name}}</ text > </ block > |
改为即可
< block wx:for = "{{filter}}" wx:key = "index" wx:item = "item" > < text wx:if = "{{item.asc}}" class = "filter-item filter-item--asc" data-index = "{{index}}" bind:tap = "filterItemTap" >{{item.name}}</ text > < text wx:else class = "filter-item" data-index = "{{index}}" bind:tap = "filterItemTap" >{{item.name}}</ text > </ block > |