所以我为wickedpicker进行了设置。这是设置
var options = {
now: "12:35", //hh:mm 24 hour format only, defaults to current time
twentyFour: true, //Display 24 hour format, defaults to false
upArrow: 'wickedpicker__controls__control-up', //The up arrow class selector to use, for custom CSS
downArrow: 'wickedpicker__controls__control-down', //The down arrow class selector to use, for custom CSS
close: 'wickedpicker__close', //The close class selector to use, for custom CSS
hoverState: 'hover-state', //The hover state class to use, for custom CSS
title: 'Setting Jam', //The Wickedpicker's title,
showSeconds: false, //Whether or not to show seconds,
secondsInterval: 1, //Change interval for seconds, defaults to 1 ,
minutesInterval: 1, //Change interval for minutes, defaults to 1
beforeShow: null, //A function to be called before the Wickedpicker is shown
show: null, //A function to be called when the Wickedpicker is shown
clearable: false, //Make the picker's input clearable (has clickable "x")
};
$('.time').wickedpicker(options);
然后我创建一个输入字段来存储时间数据
<input id="time_field" name="time_field" class="form-control time" placeholder="Time">
保存时,进入数据库的数据的格式为“ hh:mm”。 然后,我再次在编辑表单中将其显示为值。
<input id="time_field" name="time_field" class="form-control time" placeholder="Time" value="{{ $post->time }}">
但是,数据没有出现。数据仅显示默认数据,即12:35。
每次我都会编辑数据,即使我已根据数据库中的数据在输入中设置了值,时间字段也始终显示12:35。但是,当我查看源页面时,来自数据库的数据会出现在值输入部分。
然后我尝试使用jquery。当我从输入中检索数据值时,检索到的数据仍为12.35,这是wickedpicker的默认数据。
var time = $('.time').val();
console.log(time) // output 12:35
也
var time = $('.time').wickedpicker('time');
console.log(time) // output 12:35
如何在数据库中wickedpicker的输入字段中设置时间?