Commit 3602b78df80a340803c653c26fe3cd53dd6efd54

Authored by 梁灏
1 parent 7c5ccdab

update DatePicker

update DatePicker
assets/iview.png

162 KB | W: | H:

164 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
src/components/date-picker/base/date-table.vue
... ... @@ -67,10 +67,10 @@
67 67 if (newVal && !oldVal) {
68 68 this.rangeState.selecting = false;
69 69 this.markRange(newVal);
70   - this.$emit('on-pick', {
71   - minDate: this.minDate,
72   - maxDate: this.maxDate
73   - });
  70 +// this.$emit('on-pick', {
  71 +// minDate: this.minDate,
  72 +// maxDate: this.maxDate
  73 +// });
74 74 }
75 75 },
76 76 cells: {
... ...
src/components/date-picker/picker.vue
... ... @@ -265,14 +265,18 @@
265 265  
266 266 const parsedValue = parser(value, format);
267 267  
268   - if (parsedValue) {
269   - // todo 判断disabledDate
270   - correctValue = formatter(parsedValue, format);
  268 + if (parsedValue[0] instanceof Date && parsedValue[1] instanceof Date) {
  269 + if (parsedValue[0].getTime() > parsedValue[1].getTime()) {
  270 + correctValue = oldValue;
  271 + } else {
  272 + // todo 判断disabledDate
  273 + correctValue = formatter(parsedValue, format);
  274 + }
271 275 } else {
272 276 correctValue = oldValue;
273 277 }
274 278  
275   - correctDate = parsedValue;
  279 + correctDate = parser(correctValue, format);
276 280 } else {
277 281 const parsedDate = parseDate(value, format);
278 282  
... ...
test/routers/date.vue
... ... @@ -23,6 +23,7 @@
23 23 align="right"
24 24 :editable="true"
25 25 :format="format"
  26 + @on-change="change"
26 27 :options="options2"></date-picker>
27 28 </i-col>
28 29 </row>
... ... @@ -134,7 +135,7 @@
134 135 computed: {},
135 136 methods: {
136 137 change (date) {
137   - console.log(date)
  138 +// console.log(date)
138 139 },
139 140 change2 (s) {
140 141 // console.log(s)
... ...