Card 商品卡片
介绍
商品卡片,用于展示商品的图片、价格等信息。
基础用法
html
<template>
<nut-card
:img-url="state.imgUrl"
:title="state.title"
:price="state.price"
:vip-price="state.vipPrice"
:shop-desc="state.shopDesc"
:delivery="state.delivery"
:shop-name="state.shopName"
></nut-card>
</template>ts
const state = reactive({
imgUrl: "//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg",
title: "活蟹】湖塘煙雨 阳澄湖大闸蟹公4.5两 母3.5两 4对8只 鲜活生鲜螃蟹现货水产礼盒海鲜水",
price: "388",
vipPrice: "378",
shopDesc: "自营",
delivery: "厂商配送",
shopName: "阳澄湖大闸蟹自营店>"
});自定义商品标签
html
<template>
<nut-card>
<template #prolist>
<view>
<text>活鲜</text>
<text>礼盒</text>
<text>国产</text>
</view>
</template>
</nut-card>
</template>自定义店铺介绍
html
<template>
<nut-card>
<template #shopTag>
<text>自定义店铺介绍</text>
</template>
<template #price>
<text>询价</text>
</template>
<template #origin>
<image src="https://img11.360buyimg.com/jdphoto/s58x28_jfs/t9451/359/415622649/15318/b0943e5d/59a78495N3bd2a9f8.png"></image>
</template>
</nut-card>
</template>自定义右下角内容
html
<template>
<nut-card>
<template #footer>
<text class="customize">自定义右下角内容</text>
</template>
</nut-card>
</template>API
Props
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| img-url | 左侧图片 | string | - | - |
| title | 标题 | string | - | - |
| price | 商品价格 | string | - | - |
| vip-price | 会员价格 | string | - | - |
| shop-desc | 店铺介绍 | string | - | - |
| delivery | 配送方式 | string | - | - |
| shop-name | 店铺名称 | string | - | - |
| is-need-price | 是否需要价格展示 | boolean | - | true |
Slots
| 名称 | 说明 |
|---|---|
| prolist | 自定义商品介绍 |
| price | 价格自定义内容 |
| origin | 价格后方自定义内容 |
| shopTag | 店铺介绍自定义 |
shopName 1.6.4 | 店铺名称自定义 |
| footer | 右下角内容自定义 |
主题定制
样式变量
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 组件。
| 名称 | 默认值 |
|---|---|
| --nut-card-font-size-0 | var(--nut-font-size-0) |
| --nut-card-font-size-1 | var(--nut-font-size-1) |
| --nut-card-font-size-2 | var(--nut-font-size-2) |
| --nut-card-font-size-3 | var(--nut-font-size-3) |
| --nut-card-left-border-radius | 0 |
| --nut-card-left-background-color | inherit |
