Pārlūkot izejas kodu

DatePicker: add range-separator prop, close #2568

qingwei.li 8 gadi atpakaļ
vecāks
revīzija
82932c0040

+ 1 - 0
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  |

+ 1 - 0
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  |

+ 1 - 0
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
 | 参数      | 说明          | 类型      | 可选值                           | 默认值  |

+ 1 - 0
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
 | 参数      | 说明          | 类型      | 可选值                           | 默认值  |

+ 5 - 1
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,