DateTimePicker: update docs for default-time (#10511)

pull/10515/head
杨奕 2018-04-02 13:20:43 +08:00 committed by GitHub
parent 464f81886f
commit 3ee0c5960b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 28 deletions

View File

@ -54,7 +54,7 @@
value1: '', value1: '',
value2: '', value2: '',
value3: '', value3: '',
value4: new Date(), value4: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
value5: '', value5: '',
value6: '', value6: '',
value7: '' value7: ''
@ -295,7 +295,7 @@ DateTimePicker is derived from DatePicker and TimePicker. For a more detailed ex
| picker-options | additional options, check the table below | object | — | {} | | picker-options | additional options, check the table below | object | — | {} |
| range-separator | range separator | string | - | '-' | | range-separator | range separator | string | - | '-' |
| default-value | optional, default date of the calendar | Date | anything accepted by `new Date()` | — | | default-value | optional, default date of the calendar | Date | anything accepted by `new Date()` | — |
| default-time | the time value to use when selecting date range | string[] | Array with length 2, each item is a string like `12:00:00`. The first item for the start date and then second item for the end date | — | | default-time | the default time value after picking a date | non-range: string / range: string[] | non-range: a string like `12:00:00`, range: array of two strings, and the first item is for the start date and second for the end date. `00:00:00` will be used if not specified | — |
| value-format | optional, format of binding value. If not specified, the binding value will be a Date object | string | see [date formats](#/en-US/component/date-picker#date-formats) | — | | value-format | optional, format of binding value. If not specified, the binding value will be a Date object | string | see [date formats](#/en-US/component/date-picker#date-formats) | — |
| name | same as `name` in native input | string | — | — | | name | same as `name` in native input | string | — | — |
| unlink-panels | unllink two date-panels in range-picker | boolean | — | false | | unlink-panels | unllink two date-panels in range-picker | boolean | — | false |

View File

@ -53,10 +53,11 @@
}, },
value1: '', value1: '',
value2: '', value2: '',
value3: new Date(), value3: '',
value4: '', value4: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
value5: '', value5: '',
value6: '' value6: '',
value7: ''
}; };
} }
}; };
@ -118,6 +119,15 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
:picker-options="pickerOptions1"> :picker-options="pickerOptions1">
</el-date-picker> </el-date-picker>
</div> </div>
<div class="block">
<span class="demonstration">With default time</span>
<el-date-picker
v-model="value3"
type="datetime"
placeholder="Select date and time"
default-time="12:00:00">
</el-date-picker>
</div>
</template> </template>
<script> <script>
@ -147,7 +157,8 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
}] }]
}, },
value1: '', value1: '',
value2: '' value2: '',
value3: ''
}; };
} }
}; };
@ -164,7 +175,7 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
<div class="block"> <div class="block">
<span class="demonstration">Default</span> <span class="demonstration">Default</span>
<el-date-picker <el-date-picker
v-model="value3" v-model="value4"
type="datetimerange" type="datetimerange"
range-separator="To" range-separator="To"
start-placeholder="Start date" start-placeholder="Start date"
@ -174,7 +185,7 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
<div class="block"> <div class="block">
<span class="demonstration">With shortcuts</span> <span class="demonstration">With shortcuts</span>
<el-date-picker <el-date-picker
v-model="value4" v-model="value5"
type="datetimerange" type="datetimerange"
:picker-options="pickerOptions2" :picker-options="pickerOptions2"
range-separator="To" range-separator="To"
@ -216,8 +227,8 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
} }
}] }]
}, },
value3: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)], value4: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
value4: '' value5: ''
}; };
} }
}; };
@ -233,7 +244,7 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
<div class="block"> <div class="block">
<span class="demonstration">Start date time 12:00:00</span> <span class="demonstration">Start date time 12:00:00</span>
<el-date-picker <el-date-picker
v-model="value5" v-model="value6"
type="datetimerange" type="datetimerange"
start-placeholder="Start Date" start-placeholder="Start Date"
end-placeholder="End Date" end-placeholder="End Date"
@ -243,7 +254,7 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
<div class="block"> <div class="block">
<span class="demonstration">Start date time 12:00:00, end date time 08:00:00</span> <span class="demonstration">Start date time 12:00:00, end date time 08:00:00</span>
<el-date-picker <el-date-picker
v-model="value6" v-model="value7"
type="datetimerange" type="datetimerange"
align="right" align="right"
start-placeholder="Start Date" start-placeholder="Start Date"
@ -257,8 +268,8 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
export default { export default {
data() { data() {
return { return {
value5: '', value6: '',
value6: '' value7: ''
}; };
} }
}; };
@ -285,7 +296,7 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
| picker-options | opciones adicionales, Comprueba la tabla de mas abajo | object | — | {} | | picker-options | opciones adicionales, Comprueba la tabla de mas abajo | object | — | {} |
| range-separator | separador de rango | string | - | '-' | | range-separator | separador de rango | string | - | '-' |
| default-value | opcional, fecha predeterminada del calendario | Fecha | cualquier cosa aceptada por `new Date()` — | | | default-value | opcional, fecha predeterminada del calendario | Fecha | cualquier cosa aceptada por `new Date()` — | |
| default-time | the time value to use when selecting date range | string[] | Array with length 2, each item is a string like `12:00:00`. The first item for the start date and then second item for the end date | — | | default-time | the default time value after picking a date | non-range: string / range: string[] | non-range: a string like `12:00:00`, range: array of two strings, and the first item is for the start date and second for the end date. `00:00:00` will be used if not specified | — |
| value-format | opcional, formato de valor de enlazado. Si no se especifica, el valor de enlazado será un objeto Date | cadena | ver [date formats](#/es/component/date-picker#date-formats) | — | | value-format | opcional, formato de valor de enlazado. Si no se especifica, el valor de enlazado será un objeto Date | cadena | ver [date formats](#/es/component/date-picker#date-formats) | — |
| name | igual que `name` en la entrada nativa | string | — | — | | name | igual que `name` en la entrada nativa | string | — | — |
| unlink-panels | desconectar dos date-panels en range-picker | boolean | — | false | | unlink-panels | desconectar dos date-panels en range-picker | boolean | — | false |

View File

@ -53,10 +53,11 @@
}, },
value1: '', value1: '',
value2: '', value2: '',
value3: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)], value3: '',
value4: '', value4: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
value5: '', value5: '',
value6: '' value6: '',
value7: ''
}; };
} }
}; };
@ -117,6 +118,15 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
:picker-options="pickerOptions1"> :picker-options="pickerOptions1">
</el-date-picker> </el-date-picker>
</div> </div>
<div class="block">
<span class="demonstration">设置默认时间</span>
<el-date-picker
v-model="value3"
type="datetime"
placeholder="选择日期时间"
default-time="12:00:00">
</el-date-picker>
</div>
</template> </template>
<script> <script>
@ -146,7 +156,8 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
}] }]
}, },
value1: '', value1: '',
value2: '' value2: '',
value3: ''
}; };
} }
}; };
@ -162,7 +173,7 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
<div class="block"> <div class="block">
<span class="demonstration">默认</span> <span class="demonstration">默认</span>
<el-date-picker <el-date-picker
v-model="value3" v-model="value4"
type="datetimerange" type="datetimerange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
@ -172,7 +183,7 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
<div class="block"> <div class="block">
<span class="demonstration">带快捷选项</span> <span class="demonstration">带快捷选项</span>
<el-date-picker <el-date-picker
v-model="value4" v-model="value5"
type="datetimerange" type="datetimerange"
:picker-options="pickerOptions2" :picker-options="pickerOptions2"
range-separator="至" range-separator="至"
@ -214,8 +225,8 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
} }
}] }]
}, },
value3: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)], value4: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
value4: '' value5: ''
}; };
} }
}; };
@ -231,7 +242,7 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
<div class="block"> <div class="block">
<span class="demonstration">起始日期时刻为 12:00:00</span> <span class="demonstration">起始日期时刻为 12:00:00</span>
<el-date-picker <el-date-picker
v-model="value5" v-model="value6"
type="datetimerange" type="datetimerange"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
@ -241,7 +252,7 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
<div class="block"> <div class="block">
<span class="demonstration">起始日期时刻为 12:00:00结束日期时刻为 08:00:00</span> <span class="demonstration">起始日期时刻为 12:00:00结束日期时刻为 08:00:00</span>
<el-date-picker <el-date-picker
v-model="value6" v-model="value7"
type="datetimerange" type="datetimerange"
align="right" align="right"
start-placeholder="开始日期" start-placeholder="开始日期"
@ -255,8 +266,8 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
export default { export default {
data() { data() {
return { return {
value5: '', value6: '',
value6: '' value7: ''
}; };
} }
}; };
@ -283,7 +294,7 @@ DateTimePicker 由 DatePicker 和 TimePicker 派生,`Picker Options` 或者其
| picker-options | 当前时间日期选择器特有的选项参考下表 | object | — | {} | | picker-options | 当前时间日期选择器特有的选项参考下表 | object | — | {} |
| range-separator | 选择范围时的分隔符 | string | - | '-' | | range-separator | 选择范围时的分隔符 | string | - | '-' |
| default-value | 可选,选择器打开时默认显示的时间 | Date | 可被`new Date()`解析 | — | | default-value | 可选,选择器打开时默认显示的时间 | Date | 可被`new Date()`解析 | — |
| default-time | 范围选择时选中日期的默认具体时刻 | string[] | 数组,长度为 2每项值为字符串形如`12:00:00`,第一项指定开始日期的时刻,第二项指定结束日期的时刻不指定会使用时刻 `00:00:00` | — | | default-time | 选中日期的默认具体时刻 | 非范围选择时string / 范围选择时:string[] | 非范围选择时:形如`12:00:00`的字符串;范围选择时:数组,长度为 2每项值为字符串形如`12:00:00`,第一项指定开始日期的时刻,第二项指定结束日期的时刻不指定会使用时刻 `00:00:00` | — |
| value-format | 可选,绑定值的格式。不指定则绑定值为 Date 对象 | string | 见[日期格式](#/zh-CN/component/date-picker#ri-qi-ge-shi) | — | | value-format | 可选,绑定值的格式。不指定则绑定值为 Date 对象 | string | 见[日期格式](#/zh-CN/component/date-picker#ri-qi-ge-shi) | — |
| name | 原生属性 | string | — | — | | name | 原生属性 | string | — | — |
| unlink-panels | 在范围选择器里取消两个日期面板之间的联动 | boolean | — | false | | unlink-panels | 在范围选择器里取消两个日期面板之间的联动 | boolean | — | false |