|
@@ -12,7 +12,7 @@
|
|
|
<el-tag
|
|
|
v-for="item in selected"
|
|
|
:key="getValueKey(item)"
|
|
|
- closable
|
|
|
+ :closable="!disabled"
|
|
|
:hit="item.hitState"
|
|
|
type="primary"
|
|
|
@close="deleteTag($event, item)"
|
|
@@ -355,22 +355,20 @@
|
|
|
},
|
|
|
|
|
|
scrollToOption(option) {
|
|
|
- if (this.$refs.popper && option) {
|
|
|
+ const target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
|
|
|
+ if (this.$refs.popper && target) {
|
|
|
const menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
|
|
|
- scrollIntoView(menu, option.$el);
|
|
|
+ scrollIntoView(menu, target);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
handleMenuEnter() {
|
|
|
- if (!this.multiple) {
|
|
|
- this.$nextTick(() => this.scrollToOption(this.selected));
|
|
|
- }
|
|
|
+ this.$nextTick(() => this.scrollToOption(this.selected));
|
|
|
},
|
|
|
|
|
|
getOption(value) {
|
|
|
let option;
|
|
|
- const type = typeof value;
|
|
|
- const isObject = type !== 'string' && type !== 'number' && type !== 'boolean';
|
|
|
+ const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
|
|
|
for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
|
|
|
const cachedOption = this.cachedOptions[i];
|
|
|
const isEqual = isObject
|
|
@@ -532,8 +530,7 @@
|
|
|
},
|
|
|
|
|
|
getValueIndex(arr = [], value) {
|
|
|
- const type = typeof value;
|
|
|
- const isObject = type !== 'string' && type !== 'number' && type !== 'boolean';
|
|
|
+ const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
|
|
|
if (!isObject) {
|
|
|
return arr.indexOf(value);
|
|
|
} else {
|