feat(GoodsAction): add badge prop, mark info prop as deprecated

This commit is contained in:
chenjiahan
2020-03-17 20:58:06 +08:00
parent 01482f20bc
commit 0dea9e2cb1
4 changed files with 20 additions and 17 deletions
+5 -3
View File
@@ -1,4 +1,4 @@
import { createNamespace } from '../utils';
import { createNamespace, isDef } from '../utils';
import { route, routeProps } from '../utils/router';
import { ChildrenMixin } from '../mixins/relation';
import Info from '../info';
@@ -16,6 +16,7 @@ export default createComponent({
icon: String,
color: String,
info: [Number, String],
badge: [Number, String],
iconClass: null,
},
@@ -27,12 +28,13 @@ export default createComponent({
genIcon() {
const slot = this.slots('icon');
const info = isDef(this.badge) ? this.badge : this.info;
if (slot) {
return (
<div class={bem('icon')}>
{slot}
<Info dot={this.dot} info={this.info} />
<Info dot={this.dot} info={info} />
</div>
);
}
@@ -42,7 +44,7 @@ export default createComponent({
class={[bem('icon'), this.iconClass]}
tag="div"
dot={this.dot}
info={this.info}
info={info}
name={this.icon}
color={this.color}
/>