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

This commit is contained in:
chenjiahan
2020-03-17 21:01:01 +08:00
parent 0dea9e2cb1
commit db94b20c82
4 changed files with 17 additions and 14 deletions
+5 -3
View File
@@ -1,5 +1,5 @@
// Utils
import { createNamespace, addUnit } from '../utils';
import { createNamespace, addUnit, isDef } from '../utils';
import { BORDER } from '../utils/constant';
import { route, routeProps } from '../utils/router';
@@ -22,6 +22,7 @@ export default createComponent({
icon: String,
iconPrefix: String,
info: [Number, String],
badge: [Number, String],
},
computed: {
@@ -70,12 +71,13 @@ export default createComponent({
genIcon() {
const iconSlot = this.slots('icon');
const info = isDef(this.badge) ? this.badge : this.info;
if (iconSlot) {
return (
<div class={bem('icon-wrapper')}>
{iconSlot}
<Info dot={this.dot} info={this.info} />
<Info dot={this.dot} info={info} />
</div>
);
}
@@ -85,7 +87,7 @@ export default createComponent({
<Icon
name={this.icon}
dot={this.dot}
info={this.info}
info={info}
size={this.parent.iconSize}
class={bem('icon')}
classPrefix={this.iconPrefix}