<! - accordion -> < View WX: for = "{} {} produceList" WX: Key = "ID" > < View class = "Horizontal BETWEEN" Data-index = "index {} {}" bindtap = 'changeToggle' > < View class = "" > fold strip left SUMMARY </ View > < View class = "Horizontal" > fold strip to the right content < text class ? = "{{selectedFlag [index] 'Triangle-up': 'Triangle-Down'}} " > </text></view> </View > < View class = '' hidden = "{{selectedFlag [index]}!}" > <-! content folding display -> </ View > </ View >
.triangle-down{ width: 0; height: 0; border-width: 8px 4px 0; border-style: solid; border-color:#b2b2b2 transparent transparent; margin: 5rpx 0 0 10rpx; } .triangle-up{ width:0; height:0; border-width:0 4px 8px; border-style:solid; border-color:transparent transparent #b2b2b2; margin: 5rpx 0 0 10rpx; }
// default false, the state changes to modify the target value corresponding to a state index
const foldStatus = [ to false , to false , to false , to false , to false , to false , to false , to false , to false , to false , to false , to false , to false , to false , to false ]; / / a 15 data
// expand a collapsed selection changeToggle: function (E) { var index = e.currentTarget.dataset.index; IF ( the this.data.selectedFlag[index]) { this.data.selectedFlag[index] = false; } else { this.data.selectedFlag[index] = true; } this.setData({ selectedFlag: this.data.selectedFlag }) },