mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 05:29:01 +08:00
9be58078d2
* feat(demo): A-B * feat(demo): update B-checkbox * feat(demo): update CheckBox -DatePicker * feat(demo): update DatePicker - Form * feat(demo): update Form - List * feat(demo): update List-pagination * feat(demo): update List - skeleton * feat(demo): update skeleton - switch * feat(demo): update skeleton - switch * feat(demo): update switch - upload * feat(demo): update watermark * fix(demo): del hashId
75 lines
1.3 KiB
Vue
75 lines
1.3 KiB
Vue
<docs>
|
|
---
|
|
order: 3
|
|
iframe: 200
|
|
reactRouter: react-router-dom
|
|
title:
|
|
zh-CN: 其它路由
|
|
en-US: Other Router Integration
|
|
---
|
|
|
|
## zh-CN
|
|
和 `vue-router` 进行结合使用。
|
|
|
|
## en-US
|
|
Used together with `vue-router`
|
|
|
|
</docs>
|
|
|
|
<template>
|
|
<div>
|
|
<a-breadcrumb :routes="routes">
|
|
<template #itemRender="{ route, paths }">
|
|
<span v-if="routes.indexOf(route) === routes.length - 1">
|
|
{{ route.breadcrumbName }}
|
|
</span>
|
|
<router-link v-else :to="`${basePath}/${paths.join('/')}`">
|
|
{{ route.breadcrumbName }}
|
|
</router-link>
|
|
</template>
|
|
</a-breadcrumb>
|
|
<br />
|
|
{{ $route.path }}
|
|
</div>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue';
|
|
interface Route {
|
|
path: string;
|
|
breadcrumbName: string;
|
|
children?: Array<{
|
|
path: string;
|
|
breadcrumbName: string;
|
|
}>;
|
|
}
|
|
const basePath = '/components/breadcrumb';
|
|
const routes = ref<Route[]>([
|
|
{
|
|
path: 'index',
|
|
breadcrumbName: 'home',
|
|
},
|
|
{
|
|
path: 'first',
|
|
breadcrumbName: 'first',
|
|
children: [
|
|
{
|
|
path: '/general',
|
|
breadcrumbName: 'General',
|
|
},
|
|
{
|
|
path: '/layout',
|
|
breadcrumbName: 'Layout',
|
|
},
|
|
{
|
|
path: '/navigation',
|
|
breadcrumbName: 'Navigation',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: 'second',
|
|
breadcrumbName: 'second',
|
|
},
|
|
]);
|
|
</script>
|