useSlots-TS

import {useSlots, VNode} from 'vue';

export const useGetSlots = () => {
  const slots = useSlots();
  const defaults: VNode[] = [...(slots.default as (() => Array<VNode>))()];
  return {defaults};
};
posted @ 2022-05-07 15:04  MegaSu  阅读(546)  评论(0编辑  收藏  举报