需求当前是往前推90天
1 <a-range-picker 2 v-model="rangePickerDateFC" 3 :format="dateFormat" 4 @change="onChange" 5 />
1 import moment from 'moment' 2 export default { 3 name: 'OperationLog', 4 data () { 5 rangePickerDate: [], 6 }, 7 mounted () {
this.rangeFC()
8 //默认格式是2021/08/10不是后端要的,就自己转换2021-08-10 9 this.rangePickerDate = [this.getCurrentDataFront().split('/').join('-'), this.getCurrentData().split('/').join('-')] 10 }, 11 methods: { 12 moment,
// 默认值
rangeFC () {
this.rangePickerDateFC = []
this.rangePickerDateFC = [
moment(this.getCurrentDataFront(), this.dateFormat),
moment(this.getCurrentData(), this.dateFormat)
]
},
13 // 开始时间 14 getCurrentDataFront () { 15 let time = new Date((new Date() - 90 * 24 * 3600 * 1000)).toLocaleDateString() 16 return time 17 }, 18 // 结束时间 19 getCurrentData () { 20 let time = new Date().toLocaleDateString() 21 return time 22 },
//重置
Reset () {
this.queryParam = {}
this.rangeFC()
},
23 } 24 }