feat(GoodsAcitonIcon): add color prop (#5576)

This commit is contained in:
neverland
2020-01-14 15:19:21 +08:00
committed by GitHub
parent 70bfb65242
commit 0223258a01
5 changed files with 89 additions and 18 deletions
+20 -10
View File
@@ -12,6 +12,7 @@ export default createComponent({
...routeProps,
text: String,
icon: String,
color: String,
info: [Number, String],
iconClass: null
},
@@ -20,22 +21,31 @@ export default createComponent({
onClick(event) {
this.$emit('click', event);
route(this.$router, this);
},
genIcon() {
const slot = this.slots('icon');
if (slot) {
return <div class={bem('icon')}>{slot}</div>;
}
return (
<Icon
class={[bem('icon'), this.iconClass]}
tag="div"
info={this.info}
name={this.icon}
color={this.color}
/>
);
}
},
render() {
return (
<div role="button" tabindex="0" class={bem()} onClick={this.onClick}>
{this.slots('icon') ? (
<div class={bem('icon')}>{this.slots('icon')}</div>
) : (
<Icon
class={[bem('icon'), this.iconClass]}
tag="div"
info={this.info}
name={this.icon}
/>
)}
{this.genIcon()}
{this.slots() || this.text}
</div>
);