ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
上面说过,时间选择器有两种类型,分别为select与picker类型,时间范围选择只支持picker类型(任意时间点范围)。 ## 方法原型: ``` addTimerange($name = '', $title = '', $tips = '', $default = null, $attr = []) ``` ## 参数说明: ``` * @param string $name 字段名:是否必填 格式: name:require 或 name * @param string $title 标题|占位符 格式: title|placeholder,无竖线分隔则为标题 * @param string $tips 提示文字 * @param string|array $default 默认值 * @param array $attr 组件属性 { * selectable_range:可选时间段,例如'18:30:00 - 20:30:00'或者传入数组['09:30:00 - 12:00:00', '14:30:00 - 18:30:00'] * } ``` > todo` selectable_range`可选时间段配置后无效,待解决 ## 调用方式 - 添加一个时间范围选择器 ``` return SBuilder::make('form') ->addTimeRange('timerange', '时间范围') ->fetch(); ``` > 页面效果: ![](images/screenshot_1557910619292.png) ~~- 设置可选的时间段~~ > 经测试,selectable_range设置后无效,此问题与非时间范围的selectable_range不可用一起待解决。 > ``` > return SBuilder::make('form') > ->addTimeRange('timerange', '时间范围', '', null, ['selectable_range' => '08:30:00 - 18:30:00']) > ->fetch(); > ```