fix(auto-complete): support `options` slots #4012 (#4072)

pull/4258/head
John 2021-06-24 09:42:27 +08:00 committed by GitHub
parent 8d8f940552
commit 2e06d38aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -100,7 +100,10 @@ const AutoComplete = defineComponent({
[`${prefixCls}-show-search`]: true, [`${prefixCls}-show-search`]: true,
[`${prefixCls}-auto-complete`]: true, [`${prefixCls}-auto-complete`]: true,
}; };
const childArray = getSlot(this, 'dataSource'); let childArray = getSlot(this, 'dataSource');
if ('options' in this.$slots) {
childArray = getSlot(this, 'options');
}
if (childArray.length && isSelectOptionOrSelectOptGroup(childArray[0])) { if (childArray.length && isSelectOptionOrSelectOptGroup(childArray[0])) {
optionChildren = childArray; optionChildren = childArray;
} else { } else {