效果如图示:
![](https://img.haomeiwen.com/i1789550/ba14f4161fe93b97.png)
主要是需要依赖于:moment 。
首先需要引入:moment
![](https://img.haomeiwen.com/i1789550/adb89d314934ce2e.png)
再次,再methods里定义方法:
![](https://img.haomeiwen.com/i1789550/e73cb024134fe5ac.png)
然后再对于的组件地方配置:
![](https://img.haomeiwen.com/i1789550/8971ba9f29af1eb5.png)
然后定义相关预设日期对象:
// 预设日期查询条件
fanhui:
{
今天: [moment().startOf('day'), moment()],
昨天: [moment().startOf('day').subtract(1,'days'), moment().endOf('day').subtract(1, 'days')],
最近三天: [moment().startOf('day').subtract(2, 'days'), moment().endOf('day')],
最近一周: [moment().startOf('day').subtract(1, 'weeks'), moment()],
本月: [moment().startOf('month'), moment()],
本年: [moment().startOf('year'), moment()]
},
网友评论