You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
973 B
46 lines
973 B
4 years ago
|
<cn>
|
||
|
#### 预设范围
|
||
|
可以预设常用的日期范围以提高用户体验。
|
||
|
</cn>
|
||
|
|
||
|
<us>
|
||
|
#### Preset Ranges
|
||
|
We can set presetted ranges to RangePicker to improve user experience.
|
||
|
</us>
|
||
|
|
||
|
```vue
|
||
|
<template>
|
||
|
<div>
|
||
|
<a-range-picker
|
||
|
:ranges="{ Today: [moment(), moment()], 'This Month': [moment(), moment().endOf('month')] }"
|
||
|
@change="onChange"
|
||
|
/>
|
||
|
<br />
|
||
|
<a-range-picker
|
||
|
:ranges="{ Today: [moment(), moment()], 'This Month': [moment(), moment().endOf('month')] }"
|
||
|
show-time
|
||
|
format="YYYY/MM/DD HH:mm:ss"
|
||
|
@change="onChange"
|
||
|
/>
|
||
|
</div>
|
||
|
</template>
|
||
|
<script>
|
||
|
import moment from 'moment';
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
dateFormat: 'YYYY/MM/DD',
|
||
|
monthFormat: 'YYYY/MM',
|
||
|
};
|
||
|
},
|
||
|
methods: {
|
||
|
moment,
|
||
|
onChange(dates, dateStrings) {
|
||
|
console.log('From: ', dates[0], ', to: ', dates[1]);
|
||
|
console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
</script>
|
||
|
```
|