Skip to content

Commit

Permalink
fix: [Breadcrumb] routes from children
Browse files Browse the repository at this point in the history
  • Loading branch information
KouSum committed Apr 17, 2024
1 parent 955c7d1 commit dedcdc6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/semi-ui-vue/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ const App = defineComponent<ExampleProps>((props, {slots}) => {
{/*<RatingDemo />*/}
{/*<DividerDemo/>*/}
{/*<SliderDemo />*/}
<InputNumberDemo />
{/*<InputNumberDemo />*/}
{/*<ModalForm />*/}
{/*<ModalDemoHook />*/}
{/*<ModalDemoConfirm/>*/}
{/*<ModalDemo/>*/}
{/*<UploadDemo/>*/}
{/*<ProgressDemo/>*/}
{/*<SwitchDemo/>*/}
{/*<BreadcrumbDemo/>*/}
<BreadcrumbDemo/>
{/*<DatePickerDemo />*/}
{/*<TimePickerDemo />*/}
{/*<ScrollListDemo />*/}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defineComponent, ref, h, Fragment} from 'vue'
import { defineComponent, ref, h, Fragment, onMounted } from 'vue';
import Breadcrumb, {BreadcrumbItem} from "../index";
import {IconArticle, IconHome} from "@kousum/semi-icons-vue";

Expand All @@ -12,6 +12,12 @@ export const vuePropsType = {
const BreadcrumbDemo = defineComponent<BreadcrumbDemoProps>((props, {slots}) => {


const routes = ref([])
onMounted(()=>{
setTimeout(()=>{
routes.value = ['sd','sdsd']
}, 3000)
})
return () => (
<div>
<Breadcrumb separator={'<'}>
Expand Down Expand Up @@ -45,6 +51,9 @@ const BreadcrumbDemo = defineComponent<BreadcrumbDemoProps>((props, {slots}) =>
]
}
/>
<Breadcrumb
routes={routes.value}
/>
</div>
)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/semi-ui-vue/src/components/breadcrumb/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {IconMore} from '@kousum/semi-icons-vue';

import {AriaAttributes} from "../AriaAttributes";
import {VueJsxNode} from "../interface";
import {getVNodeChildren} from "../_utils";
import { getFragmentChildren, getVNodeChildren } from '../_utils';

const clsPrefix = cssClasses.PREFIX;

Expand Down Expand Up @@ -230,9 +230,9 @@ const Breadcrumb = defineComponent<BreadcrumbProps>((props, {}) => {
} = props;
const { isCollapsed } = state;
const hasRoutes = routes && routes.length > 0;
const items = getVNodeChildren(((hasRoutes ?
const items = hasRoutes ?
foundation.genRoutes(routes) :
children) as VNode[]));
(getFragmentChildren(slots) || []);

let template;

Expand Down

0 comments on commit dedcdc6

Please sign in to comment.