ekilei / yii2-numstepper-widget
输入相似数字
dev-master
2019-07-30 10:49 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: ^2.0.4
- yiisoft/yii2-bootstrap: *
This package is auto-updated.
Last update: 2024-09-29 05:22:01 UTC
README
Numstepper 是 InputWidget 的扩展,适用于自适应网站,在桌面和移动设备上使用都非常方便。
Numstepper 是 InputWidget 的扩展,专为自适应网站设计,便于在桌面和移动设备上使用。
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className()) ?>
?>
使用参数
使用参数
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'min' => -28,
'max' => 28,
])
?>
使用异常和初始化值
使用异常和初始化值
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'min' => -28,
'max' => 28,
'exclude' => [0],
'default' => (int)$model->day ? (int)$model->day : 1,
])
?>
使用提示
使用提示
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'min' => -28,
'max' => 28,
'exclude' => [0],
'default' => (int)$model->day ? (int)$model->day : 1,
])
->hint(Yii::t('app','Negative numbers make it possible to choose a day from the end of the month.').'
<br>'.Yii::t('app','Example').': "-1" = [31,30,28(29)], а "-3" = [29,28,26(27)] ')
?>
带有自定义按钮图标
带有自定义按钮图标
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'default' => (int)$model->day ? (int)$model->day : 1,
'minusButton' => 'menu-down',
'plusButton' => 'menu-up',
])
?>
按钮位置可变
按钮位置可变
<?= $form->field($model,'day')->widget(\ekilei\numstepper\Numstepper::className(),
[
'default' => (int)$model->day ? (int)$model->day : 1,
'minusButton' => 'menu-down',
'plusButton' => 'menu-up',
'prepend' => [],
'append' => ['{minus}','{plus}'],
])
?>
安装
安装
composer require ekilei/yii2-numstepper-widget "dev-master"