ant-design-vue/components/breadcrumb/index.en-US.md

50 lines
1.3 KiB
Markdown
Raw Normal View History

2018-03-09 05:26:34 +00:00
## API
| Property | Description | Type | Optional | Default |
2019-09-28 12:45:07 +00:00
| --- | --- | --- | --- | --- |
| itemRender | Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}" | ({route, params, routes, paths}) => vNode | | - |
2018-03-09 05:26:34 +00:00
| params | Routing parameters | object | | - |
| routes | The routing stack information of router | object\[] | | - |
2018-03-10 05:34:26 +00:00
| separator | Custom separator | string\|slot | | `/` |
2018-03-09 05:26:34 +00:00
### Use with browserHistory
The link of Breadcrumb item targets `#` by default, you can use `itemRender` to make a `browserHistory` Link.
2019-09-28 12:45:07 +00:00
```html
2018-03-10 05:34:26 +00:00
<template>
2019-09-28 12:45:07 +00:00
<a-breadcrumb :routes="routes">
<template slot="itemRender" slot-scope="{route, params, routes, paths}">
<span v-if="routes.indexOf(route) === routes.length - 1">
{{route.breadcrumbName}}
</span>
<router-link v-else :to="paths.join('/')">
{{route.breadcrumbName}}
</router-link>
</template>
</a-breadcrumb>
2018-03-10 05:34:26 +00:00
</template>
<script>
export default {
2019-09-28 12:45:07 +00:00
data() {
2018-03-10 05:34:26 +00:00
return {
2019-09-28 12:45:07 +00:00
routes: [
{
path: 'index',
breadcrumbName: '首页',
},
{
path: 'first',
breadcrumbName: '一级面包屑',
},
{
path: 'second',
breadcrumbName: '当前页面',
},
],
};
2018-03-10 05:34:26 +00:00
},
2019-09-28 12:45:07 +00:00
};
2018-03-10 05:34:26 +00:00
</script>
2019-09-28 12:45:07 +00:00
```