diff --git a/components/badge/Badge.vue b/components/badge/Badge.vue index dcc657788..b84f8f9f5 100644 --- a/components/badge/Badge.vue +++ b/components/badge/Badge.vue @@ -7,7 +7,7 @@ import getTransitionProps from '../_util/getTransitionProps' export const BadgeProps = { /** Number to show in badge */ - count: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + count: PropTypes.oneOfType([PropTypes.number, PropTypes.string, null]), showZero: PropTypes.bool, /** Max count to show */ overflowCount: PropTypes.number, diff --git a/components/badge/ScrollNumber.vue b/components/badge/ScrollNumber.vue index 4375ee5fe..c4d6d5dc5 100644 --- a/components/badge/ScrollNumber.vue +++ b/components/badge/ScrollNumber.vue @@ -14,7 +14,7 @@ function getNumberArray (num) { const ScrollNumberProps = { prefixCls: PropTypes.string.def('ant-scroll-number'), - count: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(null), + count: PropTypes.oneOfType([PropTypes.number, PropTypes.string, null]).def(null), component: PropTypes.string, title: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), } diff --git a/components/breadcrumb/Breadcrumb.vue b/components/breadcrumb/Breadcrumb.vue index eb6cddec1..a3a138d6f 100644 --- a/components/breadcrumb/Breadcrumb.vue +++ b/components/breadcrumb/Breadcrumb.vue @@ -1,24 +1,90 @@ diff --git a/components/breadcrumb/BreadcrumbItem.vue b/components/breadcrumb/BreadcrumbItem.vue index b50f07677..7f636604a 100644 --- a/components/breadcrumb/BreadcrumbItem.vue +++ b/components/breadcrumb/BreadcrumbItem.vue @@ -1,30 +1,29 @@ - ``` diff --git a/components/breadcrumb/demo/index.vue b/components/breadcrumb/demo/index.vue index 61e91449a..7bcf918f1 100644 --- a/components/breadcrumb/demo/index.vue +++ b/components/breadcrumb/demo/index.vue @@ -2,6 +2,7 @@ import Basic from './basic.md' import WithIcon from './withIcon.md' import Separator from './separator.md' + import Router from './router' import US from './../index.en-US.md' import CN from './../index.zh-CN.md' @@ -27,6 +28,10 @@ } export default { + category: 'Components', + subtitle: '面包屑', + type: 'Navigation', + title: 'Breadcrumb', render () { return (
@@ -34,6 +39,7 @@ + diff --git a/components/breadcrumb/demo/router.md b/components/breadcrumb/demo/router.md new file mode 100644 index 000000000..5c320226f --- /dev/null +++ b/components/breadcrumb/demo/router.md @@ -0,0 +1,48 @@ + + #### vue-router +和 `vue-router` 进行结合使用。 + + + + #### Vue Router Integration +Used together with `vue-router` + + +```html + + +``` diff --git a/components/breadcrumb/demo/separator.md b/components/breadcrumb/demo/separator.md index f4a8cbba9..ea116882c 100644 --- a/components/breadcrumb/demo/separator.md +++ b/components/breadcrumb/demo/separator.md @@ -1,33 +1,30 @@ #### 分隔符 - 使用` separator=">" `可以自定义分隔符 + 使用` separator=">" `可以自定义分隔符,或者使用slot="separator"自定义更复杂的分隔符 #### Configuring the Separator - The separator can be customized by setting the separator preperty: separator=">" + The separator can be customized by setting the separator preperty: separator=">" or use + slot="separator" ```html - - - ``` diff --git a/components/breadcrumb/demo/withIcon.md b/components/breadcrumb/demo/withIcon.md index a24888ed1..d1269e924 100644 --- a/components/breadcrumb/demo/withIcon.md +++ b/components/breadcrumb/demo/withIcon.md @@ -10,30 +10,17 @@ ```html - - - ``` diff --git a/components/breadcrumb/index.en-US.md b/components/breadcrumb/index.en-US.md index 0ed0297fa..ac0aca05d 100644 --- a/components/breadcrumb/index.en-US.md +++ b/components/breadcrumb/index.en-US.md @@ -2,34 +2,44 @@ | Property | Description | Type | Optional | Default | | -------- | ----------- | ---- | -------- | ------- | -| itemRender | Custom item renderer | (route, params, routes, paths) => ReactNode | | - | +| itemRender | Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}" | ({route, params, routes, paths}) => vNode | | - | | params | Routing parameters | object | | - | | routes | The routing stack information of router | object\[] | | - | -| separator | Custom separator | string\|ReactNode | | `/` | - -> `linkRender` and `nameRender` were removed after `antd@2.0`, please use `itemRender` instead. +| separator | Custom separator | string\|slot | | `/` | ### Use with browserHistory The link of Breadcrumb item targets `#` by default, you can use `itemRender` to make a `browserHistory` Link. -```vue -import { Link } from 'react-router'; - -const routes = [{ - path: 'index', -  breadcrumbName: 'home' -}, { - path: 'first', - breadcrumbName: 'first' -}, { - path: 'second', - breadcrumbName: 'second' -}]; -function itemRender(route, params, routes, paths) { - const last = routes.indexOf(route) === routes.length - 1; - return last ? {route.breadcrumbName} : {route.breadcrumbName}; -} - -return ; -``` +````html + + +```` \ No newline at end of file diff --git a/components/breadcrumb/index.zh-CN.md b/components/breadcrumb/index.zh-CN.md index 649557606..1b65475c2 100644 --- a/components/breadcrumb/index.zh-CN.md +++ b/components/breadcrumb/index.zh-CN.md @@ -2,7 +2,7 @@ | 参数 | 说明 | 类型 | 可选值 | 默认值 | | --- | --- | --- | --- | --- | -| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => ReactNode | | - | +| itemRender | 自定义链接函数,和 vue-router 配置使用, 也可使用slot="itemRender" 和 slot-scope="props" | ({route, params, routes, paths}) => vNode | | - | | params | 路由的参数 | object | | - | | routes | router 的路由栈信息 | object\[] | | - | | separator | 分隔符自定义 | string\|slot | | '/' | @@ -12,22 +12,34 @@ 和 vue-router 一起使用时,默认生成的 url 路径是带有 `#` 的,如果和 browserHistory 一起使用的话,你可以使用 `itemRender` 属性定义面包屑链接。 ````html -import { Link } from 'react-router'; - -const routes = [{ - path: 'index', - breadcrumbName: '首页' -}, { - path: 'first', - breadcrumbName: '一级面包屑' -}, { - path: 'second', - breadcrumbName: '当前页面' -}]; -function itemRender(route, params, routes, paths) { - const last = routes.indexOf(route) === routes.length - 1; - return last ? {route.breadcrumbName} : {route.breadcrumbName}; -} - -return ; + + ```` diff --git a/components/breadcrumb/style/index.less b/components/breadcrumb/style/index.less index 1b56a3472..2d73ab20c 100644 --- a/components/breadcrumb/style/index.less +++ b/components/breadcrumb/style/index.less @@ -5,22 +5,23 @@ .@{breadcrumb-prefix-cls} { .reset-component; - color: @text-color-secondary; + color: @breadcrumb-base-color; + font-size: @breadcrumb-font-size; .@{iconfont-css-prefix} { - font-size: @font-size-sm; + font-size: @breadcrumb-icon-font-size; } a { - color: @text-color-secondary; + color: @breadcrumb-link-color; transition: color .3s; &:hover { - color: @primary-5; + color: @breadcrumb-link-color-hover; } } & > span:last-child { - color: @text-color; + color: @breadcrumb-last-item-color; } & > span:last-child &-separator { @@ -28,8 +29,8 @@ } &-separator { - margin: 0 @padding-xs; - color: @text-color-secondary; + margin: @breadcrumb-separator-margin; + color: @breadcrumb-separator-color; } &-link { diff --git a/components/cascader/demo/custom-render.md b/components/cascader/demo/custom-render.md index 4433bb685..3884422de 100644 --- a/components/cascader/demo/custom-render.md +++ b/components/cascader/demo/custom-render.md @@ -12,10 +12,10 @@ For instance, add an external link after the selected value. ```html