Scrollbar: return if component gets destroyed in mounted hook (#2588)

* Scrollbar: return if component gets destroyed in mounted hook

* Select: handle paste events in filterable mode
pull/2629/merge
杨奕 2017-02-04 16:15:24 +08:00 committed by baiyaaaaa
parent 6dd09cc11d
commit 332b58886d
2 changed files with 5 additions and 1 deletions

View File

@ -104,6 +104,7 @@ export default {
update() { update() {
let heightPercentage, widthPercentage; let heightPercentage, widthPercentage;
const wrap = this.wrap; const wrap = this.wrap;
if (!wrap) return;
heightPercentage = (wrap.clientHeight * 100 / wrap.scrollHeight); heightPercentage = (wrap.clientHeight * 100 / wrap.scrollHeight);
widthPercentage = (wrap.clientWidth * 100 / wrap.scrollWidth); widthPercentage = (wrap.clientWidth * 100 / wrap.scrollWidth);

View File

@ -59,6 +59,7 @@
@keydown.native.enter.prevent="selectOption" @keydown.native.enter.prevent="selectOption"
@keydown.native.esc.prevent="visible = false" @keydown.native.esc.prevent="visible = false"
@keydown.native.tab="visible = false" @keydown.native.tab="visible = false"
@paste.native="debouncedOnInputChange"
@mouseenter.native="inputHovering = true" @mouseenter.native="inputHovering = true"
@mouseleave.native="inputHovering = false" @mouseleave.native="inputHovering = false"
:icon="iconClass"> :icon="iconClass">
@ -243,6 +244,8 @@
}); });
this.hoverIndex = -1; this.hoverIndex = -1;
if (this.multiple && this.filterable) { if (this.multiple && this.filterable) {
this.inputLength = this.$refs.input.value.length * 15 + 20;
this.managePlaceholder();
this.resetInputHeight(); this.resetInputHeight();
} }
if (this.remote && typeof this.remoteMethod === 'function') { if (this.remote && typeof this.remoteMethod === 'function') {
@ -651,7 +654,7 @@
this.resetInputHeight(); this.resetInputHeight();
} }
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.reference.$el) { if (this.$refs.reference && this.$refs.reference.$el) {
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width; this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
} }
}); });