Skip to content

Commit bf06240

Browse files
committed
Select: fix i18n bug of placeholder
1 parent 45c0ef4 commit bf06240

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/select/src/select.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
import debounce from 'throttle-debounce/debounce';
146146
import Clickoutside from 'element-ui/src/utils/clickoutside';
147147
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
148-
import { t } from 'element-ui/src/locale';
149148
import scrollIntoView from 'element-ui/src/utils/scroll-into-view';
150149
import { getValueByPath, valueEquals, isIE, isEdge } from 'element-ui/src/utils/util';
151150
import NavigationMixin from './navigation-mixin';
@@ -235,6 +234,9 @@
235234
return ['small', 'mini'].indexOf(this.selectSize) > -1
236235
? 'mini'
237236
: 'small';
237+
},
238+
propPlaceholder() {
239+
return typeof this.placeholder !== 'undefined' ? this.placeholder : this.t('el.select.placeholder');
238240
}
239241
},
240242
@@ -288,9 +290,7 @@
288290
},
289291
placeholder: {
290292
type: String,
291-
default() {
292-
return t('el.select.placeholder');
293-
}
293+
required: false
294294
},
295295
defaultFirstOption: Boolean,
296296
reserveKeyword: Boolean,
@@ -339,7 +339,7 @@
339339
});
340340
},
341341
342-
placeholder(val) {
342+
propPlaceholder(val) {
343343
this.cachedPlaceHolder = this.currentPlaceholder = val;
344344
},
345345
@@ -838,7 +838,7 @@
838838
},
839839
840840
created() {
841-
this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder;
841+
this.cachedPlaceHolder = this.currentPlaceholder = this.propPlaceholder;
842842
if (this.multiple && !Array.isArray(this.value)) {
843843
this.$emit('input', []);
844844
}

0 commit comments

Comments
 (0)