这个需求还是很变态的,其实解决思路也很简单,layui的日期组件其实就是多个列表,把日期组件中分钟15的倍数以外的列表行都隐藏掉。
style属性
/**只显示时分 */
input[readonly] {
cursor: pointer;
}
/**以一刻钟为单位 */
.layui-laydate-list.laydate-time-list > li {
width: 50%;
}
.layui-laydate-list.laydate-time-list > li:nth-child(3) {
display: none !important;
}
.layui-laydate-list.laydate-time-list > li:nth-child(2) > ol > li {
display: none;
}
.layui-laydate-list.laydate-time-list > li:nth-child(2) > ol > li:nth-child(15n+1) {
display: list-item;
}
日期组件
laydate.render({
trigger: "click",
btns: ['clear', 'confirm'],
elem: "#startTime",
type: "time",
theme: "molv",
format: 'HH:mm'
});