feat(GoodsAcitonIcon): add color prop (#5576)
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user