2018-03-18 14:05:55 +00:00
|
|
|
<cn>
|
|
|
|
#### 日期格式
|
2018-03-15 13:40:34 +00:00
|
|
|
使用 `format` 属性,可以自定义日期显示格式。
|
2018-03-18 14:05:55 +00:00
|
|
|
</cn>
|
2018-03-15 13:40:34 +00:00
|
|
|
|
2018-03-18 14:05:55 +00:00
|
|
|
<us>
|
|
|
|
#### Date Format
|
2018-03-15 13:40:34 +00:00
|
|
|
We can set the date format by `format`.
|
2018-03-18 14:05:55 +00:00
|
|
|
</us>
|
2018-03-15 13:40:34 +00:00
|
|
|
|
2018-03-18 14:05:55 +00:00
|
|
|
```html
|
|
|
|
<template>
|
2018-03-15 13:40:34 +00:00
|
|
|
<div>
|
2018-03-18 14:05:55 +00:00
|
|
|
<a-date-picker :defaultValue="moment('2015/01/01', dateFormat)" :format="dateFormat" />
|
2018-03-15 13:40:34 +00:00
|
|
|
<br />
|
2018-03-18 14:05:55 +00:00
|
|
|
<a-month-picker :defaultValue="moment('2015/01', monthFormat)" :format="monthFormat" />
|
2018-03-15 13:40:34 +00:00
|
|
|
<br />
|
2018-03-18 14:05:55 +00:00
|
|
|
<a-range-picker
|
|
|
|
:defaultValue="[moment('2015/01/01', dateFormat), moment('2015/01/01', dateFormat)]"
|
|
|
|
:format="dateFormat"
|
2018-03-15 13:40:34 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2018-03-18 14:05:55 +00:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-09-28 12:45:07 +00:00
|
|
|
import moment from 'moment';
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dateFormat: 'YYYY/MM/DD',
|
|
|
|
monthFormat: 'YYYY/MM',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
moment,
|
|
|
|
},
|
|
|
|
};
|
2018-03-18 14:05:55 +00:00
|
|
|
</script>
|
|
|
|
```
|