Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions packages/cascader/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<template v-if="showAllLevels">
<template v-for="(label, index) in currentLabels">
{{ label }}
<span v-if="index < currentLabels.length - 1"> {{ separator }} </span>
<span v-if="index < currentLabels.length - 1" :key="index"> {{ separator }} </span>
</template>
</template>
<template v-else>
Expand Down Expand Up @@ -178,7 +178,9 @@ export default {
menuVisible: false,
inputHover: false,
inputValue: '',
flatOptions: null
flatOptions: null,
id: generateId(),
needFocus: true
};
},

Expand Down Expand Up @@ -215,9 +217,6 @@ export default {
},
cascaderDisabled() {
return this.disabled || (this.elForm || {}).disabled;
},
id() {
return generateId();
}
},

Expand Down Expand Up @@ -280,7 +279,11 @@ export default {
hideMenu() {
this.inputValue = '';
this.menu.visible = false;
this.$refs.input.focus();
if (this.needFocus) {
this.$refs.input.focus();
} else {
this.needFocus = true;
}
},
handleActiveItemChange(value) {
this.$nextTick(_ => {
Expand Down Expand Up @@ -387,6 +390,9 @@ export default {
this.handlePick([], true);
},
handleClickoutside() {
if (this.menuVisible) {
this.needFocus = false;
}
this.menuVisible = false;
},
handleClick() {
Expand Down
6 changes: 2 additions & 4 deletions packages/cascader/src/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
changeOnSelect: false,
popperClass: '',
hoverTimer: 0,
clicking: false
clicking: false,
id: generateId()
};
},

Expand Down Expand Up @@ -97,9 +98,6 @@
formatOptions(optionsCopy);
return loadActiveOptions(optionsCopy);
}
},
id() {
return generateId();
}
},

Expand Down
6 changes: 2 additions & 4 deletions packages/dropdown/src/dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,14 @@
menuItems: null,
menuItemsArray: null,
dropdownElm: null,
focusing: false
focusing: false,
listId: `dropdown-menu-${generateId()}`
};
},

computed: {
dropdownSize() {
return this.size || (this.$ELEMENT || {}).size;
},
listId() {
return `dropdown-menu-${generateId()}`;
}
},

Expand Down