Commit 28836d46265d2c4fd08db9151feb621079a75bf9
1 parent
75460ce6
append and prepend
Showing
1 changed file
with
9 additions
and
10 deletions
Show diff stats
src/components/input/input.vue
@@ -201,6 +201,8 @@ | @@ -201,6 +201,8 @@ | ||
201 | return { | 201 | return { |
202 | currentValue: this.value, | 202 | currentValue: this.value, |
203 | prefixCls: prefixCls, | 203 | prefixCls: prefixCls, |
204 | + prepend: true, | ||
205 | + append: true, | ||
204 | slotReady: false, | 206 | slotReady: false, |
205 | textareaStyles: {}, | 207 | textareaStyles: {}, |
206 | isOnComposition: false, | 208 | isOnComposition: false, |
@@ -214,16 +216,6 @@ | @@ -214,16 +216,6 @@ | ||
214 | if (type === 'password' && this.password && this.showPassword) type = 'text'; | 216 | if (type === 'password' && this.password && this.showPassword) type = 'text'; |
215 | return type; | 217 | return type; |
216 | }, | 218 | }, |
217 | - prepend () { | ||
218 | - let state = false; | ||
219 | - if (this.type !== 'textarea') state = this.$slots.prepend !== undefined; | ||
220 | - return state; | ||
221 | - }, | ||
222 | - append () { | ||
223 | - let state = false; | ||
224 | - if (this.type !== 'textarea') state = this.$slots.append !== undefined; | ||
225 | - return state; | ||
226 | - }, | ||
227 | showPrefix () { | 219 | showPrefix () { |
228 | let state = false; | 220 | let state = false; |
229 | if (this.type !== 'textarea') state = this.prefix !== '' || this.$slots.prefix !== undefined; | 221 | if (this.type !== 'textarea') state = this.prefix !== '' || this.$slots.prefix !== undefined; |
@@ -422,6 +414,13 @@ | @@ -422,6 +414,13 @@ | ||
422 | } | 414 | } |
423 | }, | 415 | }, |
424 | mounted () { | 416 | mounted () { |
417 | + if (this.type !== 'textarea') { | ||
418 | + this.prepend = this.$slots.prepend !== undefined; | ||
419 | + this.append = this.$slots.append !== undefined; | ||
420 | + } else { | ||
421 | + this.prepend = false; | ||
422 | + this.append = false; | ||
423 | + } | ||
425 | this.slotReady = true; | 424 | this.slotReady = true; |
426 | this.resizeTextarea(); | 425 | this.resizeTextarea(); |
427 | this.handleCalcIconOffset(); | 426 | this.handleCalcIconOffset(); |