item.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { moneyFormat } from '@/helpers/utils'
  2. import { Cell, Image } from 'vant'
  3. import { defineComponent } from 'vue'
  4. import styles from './index.module.less'
  5. export default defineComponent({
  6. name: 'GoodItem',
  7. props: {
  8. item: {
  9. type: Object,
  10. default: {}
  11. }
  12. },
  13. setup({ item }) {
  14. return () => (
  15. <Cell
  16. center
  17. v-slots={{
  18. icon: () => (
  19. <Image class={styles.goodsImg} src={item.productPic} fit="cover" />
  20. ),
  21. default: () => (
  22. <div class={styles.goodsContainer}>
  23. <div class={[styles.goodsTitle, 'van-ellipsis']}>
  24. {item.productName}
  25. </div>
  26. <div class={styles.model}>{item.productAttr}</div>
  27. <div class={styles.goodsPrice}>
  28. <span class={styles.price}>
  29. <i>¥</i>
  30. {moneyFormat(item.productPrice)}
  31. </span>
  32. <span class={styles.num}>x{item.productQuantity}</span>
  33. </div>
  34. </div>
  35. )
  36. }}
  37. ></Cell>
  38. )
  39. }
  40. })