import { use, isDef } from '../utils'; import Tag from '../tag'; const [sfc, bem] = use('card'); export default sfc({ props: { tag: String, desc: String, thumb: String, title: String, centered: Boolean, lazyLoad: Boolean, thumbLink: String, num: [Number, String], price: [Number, String], originPrice: [Number, String], currency: { type: String, default: '¥' } }, render(h) { const { thumb, $slots: slots } = this; const Thumb = (slots.thumb || thumb) && ( {slots.thumb || (this.lazyLoad ? ( ) : ( ))} {this.tag && ( {this.tag} )} ); const Title = slots.title || (this.title &&
{this.title}
); const Desc = slots.desc || (this.desc &&
{this.desc}
); const Price = (slots.price || isDef(this.price)) && (
{slots.price || `${this.currency} ${this.price}`}
); const OriginPrice = isDef(this.originPrice) && (
{`${this.currency} ${this.originPrice}`}
); const Num = (slots.num || isDef(this.num)) && (
{slots.num || `x ${this.num}`}
); const Footer = slots.footer &&
{slots.footer}
; return (
{Thumb}
{Title} {Desc} {slots.tags}
{Price} {OriginPrice} {Num}
{Footer}
); } });