Commit 28836d46265d2c4fd08db9151feb621079a75bf9

Authored by FEI
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 201 return {
202 202 currentValue: this.value,
203 203 prefixCls: prefixCls,
  204 + prepend: true,
  205 + append: true,
204 206 slotReady: false,
205 207 textareaStyles: {},
206 208 isOnComposition: false,
... ... @@ -214,16 +216,6 @@
214 216 if (type === 'password' && this.password && this.showPassword) type = 'text';
215 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 219 showPrefix () {
228 220 let state = false;
229 221 if (this.type !== 'textarea') state = this.prefix !== '' || this.$slots.prefix !== undefined;
... ... @@ -422,6 +414,13 @@
422 414 }
423 415 },
424 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 424 this.slotReady = true;
426 425 this.resizeTextarea();
427 426 this.handleCalcIconOffset();
... ...