From 82932c0040852a0c4a384728cdf6b302e5d92aba Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 23 Jan 2017 15:35:06 +0800 Subject: [PATCH] DatePicker: add range-separator prop, close #2568 --- examples/docs/en-US/date-picker.md | 1 + examples/docs/en-US/datetime-picker.md | 1 + examples/docs/zh-CN/date-picker.md | 1 + examples/docs/zh-CN/datetime-picker.md | 1 + packages/date-picker/src/picker.vue | 6 +++++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/docs/en-US/date-picker.md b/examples/docs/en-US/date-picker.md index c30cdee2c..093497610 100644 --- a/examples/docs/en-US/date-picker.md +++ b/examples/docs/en-US/date-picker.md @@ -261,6 +261,7 @@ Picking a date range is supported. | align | alignment | left/center/right | left | | popper-class | custom class name for DatePicker's dropdown | string | — | — | | picker-options | additional options, check the table below | object | — | {} | +| range-separator | range separator | string | - | ' - ' | ### Picker Options | Attribute | Description | Type | Accepted Values | Default | diff --git a/examples/docs/en-US/datetime-picker.md b/examples/docs/en-US/datetime-picker.md index 11996ff88..63a984b06 100644 --- a/examples/docs/en-US/datetime-picker.md +++ b/examples/docs/en-US/datetime-picker.md @@ -216,6 +216,7 @@ Select date and time in one picker. | align | alignment | left/center/right | left | | popper-class | custom class name for DateTimePicker's dropdown | string | — | — | | picker-options | additional options, check the table below | object | — | {} | +| range-separator | range separator | string | - | ' - ' | ### Picker Options | Attribute | Description | Type | Accepted Values | Default | diff --git a/examples/docs/zh-CN/date-picker.md b/examples/docs/zh-CN/date-picker.md index dbbfaf32d..9acb4c400 100644 --- a/examples/docs/zh-CN/date-picker.md +++ b/examples/docs/zh-CN/date-picker.md @@ -295,6 +295,7 @@ | align | 对齐方式 | string | left, center, right | left | | popper-class | DatePicker 下拉框的类名 | string | — | — | |picker-options | 当前时间日期选择器特有的选项参考下表 | object | — | {} | +| range-separator | 选择范围时的分隔符 | string | - | ' - ' | ### Picker Options | 参数 | 说明 | 类型 | 可选值 | 默认值 | diff --git a/examples/docs/zh-CN/datetime-picker.md b/examples/docs/zh-CN/datetime-picker.md index 081c05ea0..e2b18de51 100644 --- a/examples/docs/zh-CN/datetime-picker.md +++ b/examples/docs/zh-CN/datetime-picker.md @@ -239,6 +239,7 @@ | align | 对齐方式 | string | left, center, right | left | | popper-class | DateTimePicker 下拉框的类名 | string | — | — | | picker-options | 当前时间日期选择器特有的选项参考下表 | object | — | {} | +| range-separator | 选择范围时的分隔符 | string | - | ' - ' | ### Picker Options | 参数 | 说明 | 类型 | 可选值 | 默认值 | diff --git a/packages/date-picker/src/picker.vue b/packages/date-picker/src/picker.vue index ef7daa212..268685b28 100644 --- a/packages/date-picker/src/picker.vue +++ b/packages/date-picker/src/picker.vue @@ -43,7 +43,7 @@ const NewPopper = { beforeDestroy: Popper.beforeDestroy }; -const RANGE_SEPARATOR = ' - '; +let RANGE_SEPARATOR = ' - '; const DEFAULT_FORMATS = { date: 'yyyy-MM-dd', month: 'yyyy-MM', @@ -202,6 +202,9 @@ export default { default: 'left' }, value: {}, + rangeSeparator: { + default: ' - ' + }, pickerOptions: {} }, @@ -324,6 +327,7 @@ export default { }, created() { + RANGE_SEPARATOR = this.rangeSeparator; // vue-popper this.options = { boundariesPadding: 0,