![](https://img.kancloud.cn/c5/62/c562ad05a4cdbd3aaac134efb87ae1d3_174x31.png)
开关组件常用于状态值的变更或只有两个值的切换。使用开关组件只需要给我们的操作按钮添加
`data-toggle="switcher"`
即可,如下:
```
<input id="c-switch" name="row[switch]" type="hidden" value="0">
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >
<i class="fa fa-toggle-on text-success {eq name="$row.switch" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
</a>
```