Smarty 封装 YII2 Form表单API - 开关 Switch

表单元素名称:开关

调用基本格式:

{input type='switch' model=$model field='is_parent' value='1' uncheck='0' items=[0='否, '1'=>'是']} 

 API说明:

1.开关的“type”必须为switch

2.value指定了勾选时的值,默认为1;uncheck指定了取消勾选时的值,默认为0.

3.items指定开关上面的文字,类型为数组,键对应value、uncheck的属性值,值对应显示的文本。

4.items的属性默认为:

['0'=>'否', '1'=>'是']

效果图:


 
 
 

猜你喜欢

转载自niqingyang.iteye.com/blog/2271870