chore: update getSlot

This commit is contained in:
tangjinzhou 2020-04-15 22:56:58 +08:00
parent 1836b2e7f4
commit 594256558a
4 changed files with 7 additions and 7 deletions

@ -1 +1 @@
Subproject commit 8dca2d2cfcaaf970f494ebfb65ee55dfca69870c
Subproject commit f9276815b07efeec931404c2cad4e998eba7af14

View File

@ -69,7 +69,7 @@ const getSlot = (self, name = 'default', options = {}) => {
return (
(self.$scopedSlots && self.$scopedSlots[name] && self.$scopedSlots[name](options)) ||
self.$slots[name] ||
[]
undefined
);
};

View File

@ -140,10 +140,10 @@ export default {
render() {
const { childrenProps } = this.$props;
const child = getSlot(this)[0];
const child = getSlot(this);
if (child && childrenProps) {
return cloneElement(child, { props: childrenProps });
return cloneElement(child[0], { props: childrenProps });
}
return child;
return child && child[0];
},
};

View File

@ -378,11 +378,11 @@ export default {
},
ref: 'trigger',
};
const children = getSlot(this, 'default')[0];
const children = getSlot(this, 'default');
return (
<Trigger {...triggerProps}>
{children &&
cloneElement(children, {
cloneElement(children[0], {
on: {
keydown: handleKeyDown,
},