parent
c782de1fe1
commit
1bbfccae19
@ -0,0 +1,25 @@
|
||||
<script>
|
||||
import PropTypes from '../_util/vue-types'
|
||||
|
||||
export default {
|
||||
name: 'Breadcrumb',
|
||||
props: {
|
||||
prefixCls: PropTypes.string.def('ant-breadcrumb'),
|
||||
separator: PropTypes.string.def('/'),
|
||||
styles: PropTypes.Object,
|
||||
},
|
||||
provide () {
|
||||
return {
|
||||
breadCrumbParent: this,
|
||||
}
|
||||
},
|
||||
render () {
|
||||
const { prefixCls, styles } = this
|
||||
return (
|
||||
<div class={prefixCls} style={styles}>
|
||||
{this.$slots.default}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
}
|
||||
</script>
|
@ -0,0 +1,33 @@
|
||||
<script>
|
||||
import PropTypes from '../_util/vue-types'
|
||||
|
||||
export default {
|
||||
name: 'BreadcrumbItem',
|
||||
inject: ['breadCrumbParent'],
|
||||
props: {
|
||||
prefixCls: PropTypes.string.def('ant-breadcrumb'),
|
||||
href: PropTypes.string,
|
||||
},
|
||||
render () {
|
||||
const { prefixCls, href, ...restProps } = this
|
||||
const { breadCrumbParent = {}} = this
|
||||
const { separator = '/' } = breadCrumbParent
|
||||
const solt = this.$slots.default
|
||||
let link
|
||||
if (href !== undefined) {
|
||||
link = <a class={`${prefixCls}-link`} {...restProps}>{solt}</a>
|
||||
} else {
|
||||
link = <span class={`${prefixCls}-link`} {...restProps}>{solt}</span>
|
||||
}
|
||||
if (solt) {
|
||||
return (
|
||||
<span>
|
||||
{link}
|
||||
<span class={`${prefixCls}-separator`}>{separator}</span>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return null
|
||||
},
|
||||
}
|
||||
</script>
|
@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div>
|
||||
基本用法
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem>Home</BreadcrumbItem>
|
||||
<BreadcrumbItem><a href="">Application Center</a></BreadcrumbItem>
|
||||
<BreadcrumbItem><a href="">Application List</a></BreadcrumbItem>
|
||||
<BreadcrumbItem>An Application</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
<br>
|
||||
带有图标
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem href="">
|
||||
<Icon type="home" />
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem href="">
|
||||
<Icon type="user" />
|
||||
<span>Application List</span>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem>
|
||||
Application
|
||||
</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
<br>
|
||||
自定义分隔符
|
||||
<Breadcrumb separator=">">
|
||||
<BreadcrumbItem>Home</BreadcrumbItem>
|
||||
<BreadcrumbItem href="">Application Center</BreadcrumbItem>
|
||||
<BreadcrumbItem href="">Application List</BreadcrumbItem>
|
||||
<BreadcrumbItem>An Application</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import '../style'
|
||||
import { Icon, Breadcrumb } from 'antd/index'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
components: {
|
||||
Icon,
|
||||
Breadcrumb,
|
||||
BreadcrumbItem: Breadcrumb.Item,
|
||||
},
|
||||
}
|
||||
</script>
|
@ -0,0 +1,5 @@
|
||||
import Breadcrumb from './Breadcrumb'
|
||||
import BreadcrumbItem from './BreadcrumbItem'
|
||||
|
||||
Breadcrumb.Item = BreadcrumbItem
|
||||
export default Breadcrumb
|
@ -0,0 +1,2 @@
|
||||
import '../../style/index.less'
|
||||
import './index.less'
|
@ -0,0 +1,40 @@
|
||||
@import "../../style/themes/default";
|
||||
@import "../../style/mixins/index";
|
||||
|
||||
@breadcrumb-prefix-cls: ~"@{ant-prefix}-breadcrumb";
|
||||
|
||||
.@{breadcrumb-prefix-cls} {
|
||||
.reset-component;
|
||||
color: @text-color-secondary;
|
||||
|
||||
.@{iconfont-css-prefix} {
|
||||
font-size: @font-size-sm;
|
||||
}
|
||||
|
||||
a {
|
||||
color: @text-color-secondary;
|
||||
transition: color .3s;
|
||||
&:hover {
|
||||
color: @primary-5;
|
||||
}
|
||||
}
|
||||
|
||||
& > span:last-child {
|
||||
color: @text-color;
|
||||
}
|
||||
|
||||
& > span:last-child &-separator {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-separator {
|
||||
margin: 0 @padding-xs;
|
||||
color: @text-color-secondary;
|
||||
}
|
||||
|
||||
&-link {
|
||||
> .@{iconfont-css-prefix} + span {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
@import '../themes/default';
|
||||
|
||||
.reset-component() {
|
||||
font-family: @font-family;
|
||||
font-size: @font-size-base;
|
||||
line-height: @line-height-base;
|
||||
color: @text-color;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
Loading…
Reference in new issue