使用thymeleaf如何编写时间选择器
要使用Thymeleaf编写时间选择器,你可以使用HTML5中自带的时间选择器,如下所示:
<input type="time" th:field="*{myTime}" />
其中,myTime是你的模型属性名。
如果你想要一个日期和时间选择器,你可以这样写:
<input type="datetime-local" th:field="*{myDateTime}" />
其中,myDateTime是你的模型属性名。
在渲染HTML时,Thymeleaf会将模型属性自动填充到表单中,用户就可以选择日期和时间了。
原文地址: https://www.cveoy.top/t/topic/b4r6 著作权归作者所有。请勿转载和采集!