import { use, isDef } from '../utils'; import Icon from '../icon'; import CellMixin from '../mixins/cell'; import RouterLink from '../mixins/router-link'; const [sfc, bem] = use('cell'); export default sfc({ mixins: [CellMixin, RouterLink], props: { size: String, clickable: Boolean, arrowDirection: String }, methods: { onClick() { this.$emit('click'); this.routerLink(); } }, render(h) { const { slots } = this; const showTitle = slots('title') || isDef(this.title); const showValue = slots() || isDef(this.value); const Title = showTitle && (
{slots('title') || {this.title}} {this.label &&
{this.label}
}
); const Value = showValue && (
{slots() || {this.value}}
); const LeftIcon = slots('icon') || ( this.icon && ); const arrowIcon = this.arrowDirection ? `arrow-${this.arrowDirection}` : 'arrow'; const RightIcon = slots('right-icon') || ( this.isLink && ); return (
{LeftIcon} {Title} {Value} {RightIcon} {slots('extra')}
); } });