From 63bd4700abbbf10eb0dbfb2984fae08142a87e17 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Thu, 20 Aug 2020 19:36:12 +0800 Subject: [PATCH] breaking change: rename Info to Badge --- components.js | 2 +- src/action-bar-icon/index.js | 11 +++---- src/action-bar/README.zh-CN.md | 1 - .../test/__snapshots__/demo.spec.js.snap | 6 ++-- .../test/__snapshots__/index.spec.js.snap | 6 ++-- src/action-bar/test/index.spec.js | 4 +-- src/badge/index.js | 21 ++++++++++++ src/badge/index.less | 29 +++++++++++++++++ .../test/__snapshots__/index.spec.js.snap | 7 ++++ src/badge/test/index.spec.js | 32 +++++++++++++++++++ src/grid-item/index.js | 8 ++--- src/grid/README.zh-CN.md | 1 - src/grid/test/__snapshots__/demo.spec.js.snap | 4 +-- .../test/__snapshots__/index.spec.js.snap | 2 +- src/grid/test/index.spec.js | 2 +- src/icon/README.zh-CN.md | 1 - src/icon/index.js | 14 +++----- .../test/__snapshots__/index.spec.js.snap | 2 +- src/info/index.js | 22 ------------- src/info/index.less | 29 ----------------- .../test/__snapshots__/index.spec.js.snap | 7 ---- src/info/test/index.spec.js | 32 ------------------- src/sidebar-item/index.js | 4 +-- src/sidebar/README.zh-CN.md | 1 - .../test/__snapshots__/demo.spec.js.snap | 6 ++-- src/style/var.less | 24 +++++++------- src/tab/README.zh-CN.md | 1 - src/tab/index.js | 1 - src/tab/test/__snapshots__/index.spec.js.snap | 6 ++-- src/tab/test/index.spec.js | 4 +-- src/tabbar-item/index.js | 8 ++--- src/tabbar-item/index.less | 2 +- src/tabbar/README.zh-CN.md | 1 - .../test/__snapshots__/demo.spec.js.snap | 8 ++--- src/tabs/Title.js | 8 ++--- src/tabs/index.js | 2 +- src/tree-select/index.js | 4 +-- .../test/__snapshots__/demo.spec.js.snap | 4 +-- .../test/__snapshots__/index.spec.js.snap | 4 +-- src/tree-select/test/index.spec.js | 4 +-- 40 files changed, 157 insertions(+), 178 deletions(-) create mode 100644 src/badge/index.js create mode 100644 src/badge/index.less create mode 100644 src/badge/test/__snapshots__/index.spec.js.snap create mode 100644 src/badge/test/index.spec.js delete mode 100644 src/info/index.js delete mode 100644 src/info/index.less delete mode 100644 src/info/test/__snapshots__/index.spec.js.snap delete mode 100644 src/info/test/index.spec.js diff --git a/components.js b/components.js index 6b040c175..d26384119 100644 --- a/components.js +++ b/components.js @@ -4,7 +4,7 @@ module.exports = [ 'cell', 'cell-group', 'icon', - 'info', + 'badge', 'image', 'col', 'row', diff --git a/src/action-bar-icon/index.js b/src/action-bar-icon/index.js index 7964f429d..c47dee5bf 100644 --- a/src/action-bar-icon/index.js +++ b/src/action-bar-icon/index.js @@ -1,8 +1,8 @@ -import { createNamespace, isDef } from '../utils'; +import { createNamespace } from '../utils'; import { route, routeProps } from '../utils/router'; import { ChildrenMixin } from '../mixins/relation'; -import Info from '../info'; import Icon from '../icon'; +import Badge from '../badge'; const [createComponent, bem] = createNamespace('action-bar-icon'); @@ -15,7 +15,6 @@ export default createComponent({ text: String, icon: String, color: String, - info: [Number, String], badge: [Number, String], iconClass: null, }, @@ -29,13 +28,11 @@ export default createComponent({ }, genIcon() { - const info = isDef(this.badge) ? this.badge : this.info; - if (this.$slots.icon) { return (
{this.$slots.icon()} - +
); } @@ -45,8 +42,8 @@ export default createComponent({ class={[bem('icon'), this.iconClass]} tag="div" dot={this.dot} - info={info} name={this.icon} + badge={this.badge} color={this.color} /> ); diff --git a/src/action-bar/README.zh-CN.md b/src/action-bar/README.zh-CN.md index 6828f658f..f7cb4b26b 100644 --- a/src/action-bar/README.zh-CN.md +++ b/src/action-bar/README.zh-CN.md @@ -98,7 +98,6 @@ export default { | icon-class | 图标额外类名 | _any_ | - | | dot `2.5.5` | 是否显示图标右上角小红点 | _boolean_ | `false` | | badge `v2.5.6` | 图标右上角徽标的内容 | _number \| string_ | - | -| info | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | _number \| string_ | - | | url | 点击后跳转的链接地址 | _string_ | - | | to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | _string \| object_ | - | | replace | 是否在跳转时替换当前页面历史 | _boolean_ | `false` | diff --git a/src/action-bar/test/__snapshots__/demo.spec.js.snap b/src/action-bar/test/__snapshots__/demo.spec.js.snap index 3b49bfc00..eb1a3881d 100644 --- a/src/action-bar/test/__snapshots__/demo.spec.js.snap +++ b/src/action-bar/test/__snapshots__/demo.spec.js.snap @@ -27,17 +27,17 @@ exports[`renders demo correctly 1`] = `
-
+
客服
-
5
+
5
购物车
-
12
+
12
店铺