2015-07-23 16:02:10 4116次浏览 3条回答 1 悬赏 10 金钱

请问yii2里面的timepicker小部件该如何使用的?本人新手,望详细指点,谢谢

  • 回答于 2015-07-24 01:05 举报
    1 条回复
    回复于 2015-07-24 10:05 回复

    这些我看过的,可是我没有安装composer,而且有点看不懂

  • 回答于 2015-07-24 09:15 举报

    当一回搬运工~

    Installation 
    
    If you do not have Composer, you may install it by following the instructions at getcomposer.org.
    
    You can then install this package using the following command:
    
    php composer.phar require "janisto/yii2-timepicker" "*"
    or add
    
    "janisto/yii2-timepicker": "*"
    to the require section of your application's composer.json file.
    
    Usage 
    
    See jQuery Timepicker options.
    
    For example to use the timepicker with a yii\base\Model:
    
    echo TimePicker::widget([
         //'language' => 'fi',
        'model' => $model,
        'attribute' => 'created_at',
        'mode' => 'datetime',
        'clientOptions'=>[
            'dateFormat' => 'yy-mm-dd',
            'timeFormat' => 'HH🇲🇲ss',
            'showSecond' => true,
        ]
    ]);
    The following example will use the name property instead:
    
    echo TimePicker::widget([
         //'language' => 'fi',
        'name'  => 'from_time',
        'value'  => $value,
        'mode' => 'time',
    ]);
    You can also use this widget in an yii\widgets\ActiveForm using the yii\widgets\ActiveField::widget() method, for example like this:
    
    echo $form->field($model, 'field')->widget(\janisto\timepicker\TimePicker::className(), [
        //'language' => 'fi',
        'mode' => 'datetime',
        'clientOptions'=>[
            'dateFormat' => 'yy-mm-dd',
            'timeFormat' => 'HH🇲🇲ss',
            'showSecond' => true,
        ]
    ]);
    
    1 条回复
    回复于 2015-07-24 10:05 回复

    这些我看过的,可是我没有安装composer,而且有点看不懂

  • 回答于 2015-07-24 10:17 举报

    我有封装了个 widgets,免 composer安装,下载地址:http://pan.baidu.com/s/1sj7hqkX

    你下好后改一下它的命名空间就可以了。放在哪里就看你的命名空间。

    4 条回复
    回复于 2015-07-24 13:52 回复

    谢谢大神,我试试看

    回复于 2015-07-24 15:41 回复

    有问题,提出,没问题,采纳吧~~

    回复于 2015-07-24 16:41 回复

    不好意思哦,之前在做其他东西的,你这个我现在是有点看不大懂。。。

    回复于 2017-08-01 17:03 回复

    太感谢,很好用。

您需要登录后才可以回答。登录 | 立即注册
流言蜚语
CEO

流言蜚语

注册时间:2015-06-03
最后登录:2018-06-13
在线时长:40小时16分
  • 粉丝13
  • 金钱18660
  • 威望0
  • 积分19060

热门问题