diff --git a/packages/semi-ui-vue/src/App.tsx b/packages/semi-ui-vue/src/App.tsx index 7cbdfeeb..e6d33b47 100755 --- a/packages/semi-ui-vue/src/App.tsx +++ b/packages/semi-ui-vue/src/App.tsx @@ -69,6 +69,7 @@ import OverflowListDemoScroll from "./components/overflowList/__test__/OverflowL import BadgeDemo from "./components/badge/__test__/BadgeDemo"; import CardDemo from "./components/card/__test__/CardDemo"; import TabsDemo from "./components/tabs/__test__/TabsDemo"; +import TabsDemoVueSFC from "./components/tabs/__test__/TabsDemoVueSFC.vue"; import AnchorDemo from "./components/anchor/__test__/AnchorDemo"; import BacktopDemo from "./components/backtop/__test__/BacktopDemo"; import StepsDemo from "./components/steps/__test__/StepsDemo"; @@ -133,7 +134,8 @@ const App = defineComponent((props, {slots}) => { {/**/} {/**/} {/**/} - {/**/} + + {/**/} {/* {a.value}*/} {/**/} @@ -200,7 +202,7 @@ const App = defineComponent((props, {slots}) => { {/**/} {/**/} - + {/**/} {/**/} {/*
*/} diff --git a/packages/semi-ui-vue/src/components/tabs/__test__/TabsDemo.tsx b/packages/semi-ui-vue/src/components/tabs/__test__/TabsDemo.tsx index 371038a7..50d10c9d 100644 --- a/packages/semi-ui-vue/src/components/tabs/__test__/TabsDemo.tsx +++ b/packages/semi-ui-vue/src/components/tabs/__test__/TabsDemo.tsx @@ -1,4 +1,4 @@ -import { defineComponent, ref, h, Fragment, useSlots, reactive } from 'vue'; +import { defineComponent, ref, h, Fragment, useSlots, reactive, onMounted } from 'vue'; import Tabs, { TabPane } from '../index'; import { IconFile, IconGlobe, IconHelpCircle } from '@kousum/semi-icons-vue'; import TabsDemo2 from './TabsDemo2'; @@ -31,16 +31,23 @@ const TabsDemo = defineComponent((props, {}) => { newTabList.splice(closeIndex, 1); state.tabList = newTabList; } + const txt = ref(1) + onMounted(()=>{ + setInterval(()=>{ + txt.value++ + }, 1000) + }) return () => { return (
+ {txt.value} - +
文档
- +
快速起步
diff --git a/packages/semi-ui-vue/src/components/tabs/__test__/TabsDemoVueSFC.vue b/packages/semi-ui-vue/src/components/tabs/__test__/TabsDemoVueSFC.vue new file mode 100644 index 00000000..269c8779 --- /dev/null +++ b/packages/semi-ui-vue/src/components/tabs/__test__/TabsDemoVueSFC.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/packages/semi-ui-vue/src/components/tabs/index.tsx b/packages/semi-ui-vue/src/components/tabs/index.tsx index e273bec1..307c0b2b 100644 --- a/packages/semi-ui-vue/src/components/tabs/index.tsx +++ b/packages/semi-ui-vue/src/components/tabs/index.tsx @@ -216,7 +216,9 @@ const Tabs = defineComponent( return tabList; } return childrenRef.value - .filter((child) => typeof child.type !== 'symbol') + .filter((child) => { + return typeof child.type !== 'symbol' && (child.type as any)?.name === 'TabPane'; + }) .map((child) => { if (child) { const { tab, icon, disabled, itemKey, closable } = child.props; @@ -266,7 +268,13 @@ const Tabs = defineComponent( return () => { const children = slots.default?.(); const children_ = getFragmentChildren(slots); - if (children_.length !== childrenRef.value.length) { + if ( + children_.length !== childrenRef.value.length || + !isEqual( + children_.map((item) => item.props), + childrenRef.value.map((item) => item.props) + ) + ) { childrenRef.value = children_; }