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