diff --git a/src/sidebar-item/index.js b/src/sidebar-item/index.js index 537d5d656..863a1fb5b 100644 --- a/src/sidebar-item/index.js +++ b/src/sidebar-item/index.js @@ -1,4 +1,4 @@ -import { createNamespace } from '../utils'; +import { createNamespace, isDef } from '../utils'; import { ChildrenMixin } from '../mixins/relation'; import { route, routeProps } from '../utils/router'; import Info from '../info'; @@ -12,6 +12,7 @@ export default createComponent({ ...routeProps, dot: Boolean, info: [Number, String], + badge: [Number, String], title: String, disabled: Boolean, }, @@ -43,7 +44,11 @@ export default createComponent({ >
{this.title} - +
); diff --git a/src/sidebar/README.md b/src/sidebar/README.md index 96a0839b4..0b8675489 100644 --- a/src/sidebar/README.md +++ b/src/sidebar/README.md @@ -32,13 +32,13 @@ export default { }; ``` -### Show Info +### Show Badge ```html - - + + ``` @@ -99,7 +99,7 @@ export default { |------|------|------|------| | title | Content | *string* | `''` | | dot `v2.2.1` | Whether to show red dot | *boolean* | `false` | -| info | Content of the badge | *number \| string* | `''` | +| badge `v2.5.6` | Content of the badge | *number \| string* | `''` | | disabled `v2.2.0` | Whether to be disabled | *boolean* | `false` | | url | Link | *string* | - | | to `v2.0.4` | Target route of the link, same as to of vue-router | *string \| object* | - | diff --git a/src/sidebar/README.zh-CN.md b/src/sidebar/README.zh-CN.md index eaf839f98..560f53714 100644 --- a/src/sidebar/README.zh-CN.md +++ b/src/sidebar/README.zh-CN.md @@ -34,15 +34,15 @@ export default { }; ``` -### 提示信息 +### 徽标提示 -设置`dot`属性后,会在右上角展示一个小红点。设置`info`属性后,会在右上角展示相应的徽标 +设置`dot`属性后,会在右上角展示一个小红点。设置`badge`属性后,会在右上角展示相应的徽标 ```html - - + + ``` @@ -108,7 +108,8 @@ export default { |------|------|------|------| | title | 内容 | *string* | `''` | | dot `v2.2.1` | 是否显示右上角小红点 | *boolean* | `false` | -| info | 右上角徽标的内容 | *number \| string* | - | +| badge `v2.5.6` | 图标右上角徽标的内容 | *number \| string* | - | +| info | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | *number \| string* | - | | disabled `v2.2.0` | 是否禁用该项 | *boolean* | `false` | | url | 点击后跳转的链接地址 | *string* | - | | to `v2.0.4` | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | diff --git a/src/sidebar/demo/index.vue b/src/sidebar/demo/index.vue index 52c871cdd..6090101ba 100644 --- a/src/sidebar/demo/index.vue +++ b/src/sidebar/demo/index.vue @@ -11,11 +11,11 @@ -

{{ $t('showInfo') }}

+

{{ $t('showBadge') }}

- - + +
@@ -45,13 +45,13 @@ export default { i18n: { 'zh-CN': { title: '标签名', - showInfo: '提示信息', + showBadge: '徽标提示', disabled: '禁用选项', changeEvent: '监听切换事件', selectTip: '你切换到了', }, 'en-US': { - showInfo: 'Show Info', + showBadge: 'Show Badge', disabled: 'Disabled', changeEvent: 'Change Event', selectTip: 'You select ',