mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-09-07 00:09:45 +08:00
refactor(Icon): use setup
This commit is contained in:
parent
1b96a45d0b
commit
785047754b
@ -24,25 +24,24 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
setup(props, { slots }) {
|
||||||
const { name } = this;
|
return () => {
|
||||||
const imageIcon = isImage(name);
|
const { tag, dot, name, size, badge, color, classPrefix } = props;
|
||||||
|
const isImageIcon = isImage(name);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<this.tag
|
<tag
|
||||||
class={[
|
class={[classPrefix, isImageIcon ? '' : `${classPrefix}-${name}`]}
|
||||||
this.classPrefix,
|
style={{
|
||||||
imageIcon ? '' : `${this.classPrefix}-${name}`,
|
color,
|
||||||
]}
|
fontSize: addUnit(size),
|
||||||
style={{
|
}}
|
||||||
color: this.color,
|
>
|
||||||
fontSize: addUnit(this.size),
|
{slots.default?.()}
|
||||||
}}
|
{isImageIcon && <img class={bem('image')} src={name} />}
|
||||||
>
|
<Badge dot={dot} badge={badge} />
|
||||||
{this.$slots.default?.()}
|
</tag>
|
||||||
{imageIcon && <img class={bem('image')} src={name} />}
|
);
|
||||||
<Badge dot={this.dot} badge={this.badge} />
|
};
|
||||||
</this.tag>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user