发表于: 2021-04-15 19:52:39
1 1967
今天完成的事情:完成了时间的插件和搜索栏
明天计划的事情:修改分页,传递数据
收获:
如何使用日历插件?
我使用的是layDate插件
首先到官网https://www.layui.com/laydate/下载
将css文件和js文件放到assets文件夹下
在整个项目的根html,index.html中引入两个文件
<link rel="stylesheet" href="assets/icon/iconfont.css">
<link rel="stylesheet" href="assets/theme/default/laydate.css">
在需要使用插件的ts文件中声明laydate变量
declare let laydate: any;
之后就可以在项目中使用
<input class="form-control" type="text" id="end">
laydate.render({
elem: '#end', //选中元素
type: 'date', //数据类型
theme: '#4DC6FD', //主题颜色
done: (value: any, date: any, endDate: any) => {
console.log(value); //得到生成的值,如2021-04-15
console.log(date); //得到日期对象,如{year:2021,month:4,date:15,hours:0,minutes:0,seconds:0}
}
})
评论