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 }, computed: { arrowIcon() { return this.arrowDirection ? `arrow-${this.arrowDirection}` : 'arrow'; } }, methods: { onClick() { this.$emit('click'); this.routerLink(); } }, render(h) { const slots = this.$slots; const showTitle = slots.title || isDef(this.title); const showValue = slots.default || isDef(this.value); const Title = showTitle && (
{slots.title || {this.title}} {this.label &&
{this.label}
}
); const Value = showValue && (
{slots.default || {this.value}}
); const LeftIcon = slots.icon || ( this.icon && ); const RightIcon = slots['right-icon'] || ( this.isLink && ); return (
{LeftIcon} {Title} {Value} {RightIcon} {slots.extra}
); } });