mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-11-30 02:57:50 +08:00
24 lines
522 B
Vue
24 lines
522 B
Vue
import { cloneVNode, FunctionalComponent, PropType } from 'vue';
|
|
|
|
export interface ItemProps {
|
|
setRef: (element: HTMLElement) => void;
|
|
}
|
|
|
|
const Item: FunctionalComponent<ItemProps> = ({ setRef }, { slots }) => {
|
|
const children = slots.default?.();
|
|
|
|
return children && children.length
|
|
? cloneVNode(children[0], {
|
|
ref: setRef as any,
|
|
})
|
|
: children;
|
|
};
|
|
Item.props = {
|
|
setRef: {
|
|
type: Function as PropType<(element: HTMLElement) => void>,
|
|
default: () => {},
|
|
},
|
|
};
|
|
|
|
export default Item;
|