Filter

Use as tab filter.

Filter

Property

Description

Type

Default

Required

show

Show or not, optional, show hide.

Stringhide

No

maxMaximum choices, 1 for single choice.Number10000

No

onChangeSubmit selection callback upon multiple choice.(e: Object) => void 

No

Filter-item

Property

Description

Type

Default

Required

classNameCustom style.String

No

valueValue.String

Yes

idCustom identifier.String

No

selectedSelected by default.Booleanfalse

No

onChangeSubmit  selection callback upon single choice.(e:  Object) => void

No

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,
    });
  }
});