import { createNamespace, isDef } from '../utils'; import { route, routeProps } from '../utils/router'; import { ChildrenMixin } from '../mixins/relation'; import Info from '../info'; import Icon from '../icon'; const [createComponent, bem] = createNamespace('goods-action-icon'); export default createComponent({ mixins: [ChildrenMixin('vanGoodsAction')], props: { ...routeProps, dot: Boolean, text: String, icon: String, color: String, info: [Number, String], badge: [Number, String], iconClass: null, }, methods: { onClick(event) { this.$emit('click', event); route(this.$router, this); }, genIcon() { const slot = this.slots('icon'); const info = isDef(this.badge) ? this.badge : this.info; if (slot) { return (
{slot}
); } return ( ); }, }, render() { return (
{this.genIcon()} {this.slots() || this.text}
); }, });