Yao 66d6f4fc03
[improvement] 增加部分组件自定义样式类,方便自定义样式 (#352)
* 增加自定义样式类,并开放部分,在文档上体现

* 增加 cell 外部样式类说明

* 增加自定义样式类
2018-07-10 16:25:47 +08:00

62 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Card 卡片
### 使用指南
在 index.json 中引入组件
```json
{
"usingComponents": {
"zan-card": "path/to/zanui-weapp/dist/card/index"
}
}
```
### 代码演示
#### 基础用法
卡片可以用于左侧图片右侧描述信息的展示。默认是商品相关内容的展示需要展示其他内容可以使用自定义slot。
```html
<zan-card
card-class="test-card"
thumb="https://img.yzcdn.cn/upload_files/2016/11/25/FpqPXlrMRjKwJs8VdTu3ZDJCj4j5.jpeg?imageView2/2/w/200/h/200/q/90/format/jpeg"
price="999.99"
title="红烧牛肉【虚拟商品】【有库存】【有sku】"
num="2"
desc="3000克 50%"
status="已发货"
>
</zan-card>
```
#### 使用slot
`zan-card``zan-card__thumb``zan-card__detail` 组成。分别负责左侧图片展示和右侧内容区域展示。两部分内容可以使用slot进行替换。
```html
<zan-card
card-class="test-card"
useDetailSlot="{{ true }}"
>
<!-- 右侧详情 -->
<view slot="detail-slot" class="zan-card__detail">
我是标题
</view>
</zan-card>
```
### API
| 参数 | 说明 | 类型 | 默认值 |
|-----|-----|-----|-----|
| card-class | 自定义最外层class | String | -
| thumb | 左侧缩略图 | String | -
| price | 商品价格 | String | -
| title | 商品标题 | String | -
| desc | 商品描述 | String | -
| num | 商品数量 | Number | -
| status | 商品状态 | String | -
| useDetailSlot | 是否使用detail-slottrue时需要添加对应slot | Boolean | `false`
### 外部样式类
| 类名 | 说明 |
|-----------|-----------|
| card-class | 根节点自定义样式类,通过这个可以改变根节点上的样式 |
| thumb-class | 左侧图片自定义样式类,可以通过这个修改图片的展示大小形式 |