Filter

Use as tab filter.

Filter

Attribute    NameDescriptionTypeDefaultMandatory
showShow or not, optional, show hideStringhidefalse
maxMaximum choices, 1 for single choiceNumber10000false
onChangeSubmit selection callback upon multiple choice(e: Object) => voidfalse

Filter-item

Attribute    NameDescriptionTypeDefaultMandatory
classNameCustom   styleStringfalse
valueValueStringtrue
idCustom   identifierStringfalse
selectedSelected   by defaultBooleanfalsefalse
onChangeSubmit   selection callback upon single choice(e:   Object) => voidfalse

Example

copy
{
  "defaultTitle": "AntUI Component Library",
  "usingComponents": {
    "filter": "mini-antui/es/filter/index",
    "filter-item": "mini-antui/es/filter/filter-item/index"
  }
}
copy
<filter show="{{show}}" max="{{5}}" onChange="handleCallBack">
  <block a:for="{{items}}">
    <filter-item value="{{item.value}}" id="{{item.id}}" selected="{{item.selected}}"/>
  </block>
</filter>
copy
Page({
  data: {
    show: true,
    items: [
      { id: 1, value: 'Clothes', selected: true },
      { id: 1, value: 'Cupboard' },
      { id: 1, value: 'Hanger' },
      { id: 3, value: 'Digital' },
      { id: 4, value: 'Door' },
      { id: 5, value: 'Chair' },
      { id: 7, value: 'Monitor' },
      { id: 6, value: 'Game' },
      { id: 8, value: 'Food' },
    ]
  },
  handleCallBack(data) {
    my.alert({
      content: data
    });
  },
  toggleFilter() {
    this.setData({
      show: !this.data.show,
    });
  }
});