diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index 71e39ea6..1a8462c3 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -71,20 +71,18 @@ const options = ref([]); var timer: any; const getOption = (nodes: VNode[], newOptions: any[]) => { - const showNodes = nodes?.filter((item: VNode) => { - return item.children != "v-if"; - }); - - showNodes?.map((item: VNode) => { + nodes?.map((item) => { let component = item.type as Component; - if (component.name === LaySelectOption.name) { - if (item.children) { - // @ts-ignore - item.props.label = item.children.default()[0].children; - } - newOptions.push(item.props); - } else { + if(item.type.toString() == "Symbol(Fragment)") { getOption(item.children as VNode[], newOptions); + } else { + if (component.name == LaySelectOption.name) { + if (item.children) { + // @ts-ignore + item.props.label = item.children.default()[0].children; + } + newOptions.push(item.props); + } } }); }; diff --git a/package/component/src/component/tab/index.vue b/package/component/src/component/tab/index.vue index a9a09df8..19af79a6 100644 --- a/package/component/src/component/tab/index.vue +++ b/package/component/src/component/tab/index.vue @@ -25,7 +25,7 @@ import { reactive, h, createTextVNode, - Fragment, + Fragment } from "vue"; import { useResizeObserver } from "@vueuse/core"; import { TabData, TabInjectKey, TabPosition } from "./interface"; @@ -45,15 +45,14 @@ const childrens: Ref = ref([]); const tabMap = reactive(new Map()); const setItemInstanceBySlot = function (nodes: VNode[]) { - const showNodes = nodes?.filter((item: VNode) => { - return item.children != "v-if"; - }); - showNodes?.map((item) => { + nodes?.map((item) => { let component = item.type as Component; - if (component.name != tabItem.name) { + if(item.type.toString() == "Symbol(Fragment)") { setItemInstanceBySlot(item.children as VNode[]); } else { - childrens.value.push(item); + if (component.name == tabItem.name) { + childrens.value.push(item); + } } }); }; diff --git a/package/document-component/src/document/zh-CN/components/tab.md b/package/document-component/src/document/zh-CN/components/tab.md index e97052a5..02b49c0c 100644 --- a/package/document-component/src/document/zh-CN/components/tab.md +++ b/package/document-component/src/document/zh-CN/components/tab.md @@ -14,8 +14,7 @@