Commit e9dd4dab011911c4200be22f384fd79c8a018119
1 parent
b9041a0d
publish 0.9.11-rc-1
publish 0.9.11-rc-1
Showing
3 changed files
with
36 additions
and
23 deletions
Show diff stats
package.json
src/components/date-picker/picker.vue
... | ... | @@ -2,22 +2,24 @@ |
2 | 2 | <div |
3 | 3 | :class="[prefixCls]" |
4 | 4 | v-clickoutside="handleClose"> |
5 | - <i-input | |
6 | - v-el:reference | |
7 | - :class="[prefixCls + '-editor']" | |
8 | - :readonly="!editable || readonly" | |
9 | - :disabled="disabled" | |
10 | - :size="size" | |
11 | - :placeholder="placeholder" | |
12 | - :value="visualValue" | |
13 | - @on-change="handleInputChange" | |
14 | - @on-focus="handleFocus" | |
15 | - @on-blur="handleBlur" | |
16 | - @on-click="handleIconClick" | |
17 | - @mouseenter="handleInputMouseenter" | |
18 | - @mouseleave="handleInputMouseleave" | |
19 | - :icon="iconType"></i-input> | |
20 | - <Drop v-show="visible" :placement="placement" transition="slide-up" v-ref:drop> | |
5 | + <div v-el:reference> | |
6 | + <slot> | |
7 | + <i-input | |
8 | + :class="[prefixCls + '-editor']" | |
9 | + :readonly="!editable || readonly" | |
10 | + :disabled="disabled" | |
11 | + :size="size" | |
12 | + :placeholder="placeholder" | |
13 | + :value="visualValue" | |
14 | + @on-change="handleInputChange" | |
15 | + @on-focus="handleFocus" | |
16 | + @on-click="handleIconClick" | |
17 | + @mouseenter="handleInputMouseenter" | |
18 | + @mouseleave="handleInputMouseleave" | |
19 | + :icon="iconType"></i-input> | |
20 | + </slot> | |
21 | + </div> | |
22 | + <Drop v-show="opened" :placement="placement" transition="slide-up" v-ref:drop> | |
21 | 23 | <div v-el:picker></div> |
22 | 24 | </Drop> |
23 | 25 | </div> |
... | ... | @@ -166,6 +168,10 @@ |
166 | 168 | type: Boolean, |
167 | 169 | default: false |
168 | 170 | }, |
171 | + open: { | |
172 | + type: Boolean, | |
173 | + default: null | |
174 | + }, | |
169 | 175 | size: { |
170 | 176 | validator (value) { |
171 | 177 | return oneOf(value, ['small', 'large']); |
... | ... | @@ -195,6 +201,9 @@ |
195 | 201 | } |
196 | 202 | }, |
197 | 203 | computed: { |
204 | + opened () { | |
205 | + return this.open === null ? this.visible : this.open; | |
206 | + }, | |
198 | 207 | iconType () { |
199 | 208 | return this.showClose ? 'ios-close' : 'ios-calendar-outline'; |
200 | 209 | }, |
... | ... | @@ -248,9 +257,6 @@ |
248 | 257 | if (this.readonly) return; |
249 | 258 | this.visible = true; |
250 | 259 | }, |
251 | - handleBlur () { | |
252 | - | |
253 | - }, | |
254 | 260 | handleInputChange (event) { |
255 | 261 | const oldValue = this.visualValue; |
256 | 262 | const value = event.target.value; |
... | ... | @@ -325,7 +331,6 @@ |
325 | 331 | this.visible = false; |
326 | 332 | this.internalValue = ''; |
327 | 333 | this.value = ''; |
328 | - this.emitChange(this.value); | |
329 | 334 | }, |
330 | 335 | showPicker () { |
331 | 336 | if (!this.picker) { |
... | ... | @@ -353,7 +358,7 @@ |
353 | 358 | this.handleClear(); |
354 | 359 | }); |
355 | 360 | this.picker.$on('on-pick-success', () => { |
356 | - this.emitChange(this.value); | |
361 | +// this.emitChange(this.value); | |
357 | 362 | this.visible = false; |
358 | 363 | }); |
359 | 364 | |
... | ... | @@ -406,6 +411,11 @@ |
406 | 411 | if (this.picker) { |
407 | 412 | this.picker.$destroy(); |
408 | 413 | } |
414 | + }, | |
415 | + ready () { | |
416 | + if (this.open !== null) { | |
417 | + this.visible = this.open; | |
418 | + } | |
409 | 419 | } |
410 | 420 | } |
411 | 421 | </script> |
412 | 422 | \ No newline at end of file | ... | ... |
test/routers/date.vue