breaking change: rename Info to Badge

This commit is contained in:
chenjiahan
2020-08-20 19:36:12 +08:00
parent 4e5f509b2f
commit 63bd4700ab
40 changed files with 157 additions and 178 deletions
-1
View File
@@ -93,7 +93,6 @@ import 'vant/lib/icon/local.css';
| name | 图标名称或图片链接 | _string_ | - |
| dot `v2.2.1` | 是否显示图标右上角小红点 | _boolean_ | `false` |
| badge `v2.5.6` | 图标右上角徽标的内容 | _number \| string_ | - |
| info | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | _number \| string_ | - |
| color | 图标颜色 | _string_ | `inherit` |
| size | 图标大小,如 `20px` `2em`,默认单位为`px` | _number \| string_ | `inherit` |
| class-prefix | 类名前缀,用于使用自定义图标 | _string_ | `van-icon` |
+4 -10
View File
@@ -1,8 +1,5 @@
// Utils
import { addUnit, createNamespace } from '../utils';
// Components
import Info from '../info';
import Badge from '../badge';
const [createComponent, bem] = createNamespace('icon');
@@ -30,7 +27,7 @@ export default createComponent({
render() {
const { name } = this;
const imageIcon = isImage(name);
return (
<this.tag
class={[
@@ -44,11 +41,8 @@ export default createComponent({
>
{this.$slots.default?.()}
{imageIcon && <img class={bem('image')} src={name} />}
<Info
dot={this.dot}
info={this.badge}
/>
<Badge dot={this.dot} badge={this.badge} />
</this.tag>
);
}
},
});
@@ -2,7 +2,7 @@
exports[`dot prop 1`] = `
<i class="van-icon van-icon-undefined">
<div class="van-info van-info--dot"></div>
<div class="van-badge van-badge--dot"></div>
</i>
`;