captain-ui
Version:
有赞vue wap业务组件库
235 lines (221 loc) • 5.61 kB
Markdown
<script>
window._global = {
url: {
imgqn: 'https://img.yzcdn.cn'
}
}
export default {
data() {
return {
goodsList: [
{
"goods_id": "342373809",
"title": "少时诵诗书",
"discount_type": "2",
"discount_value": "10",
"thumbUrl": "https://img.yzcdn.cn/upload_files/2017/06/29/FnPSAKkEeh4FnDA09oIbmnlzWQrw.png",
"stock_num": 0,
"kdt_url": "https://h5.youzan.com/v2/showcase/goods?alias=2ohntjasyvmpx",
activityPrice: 5999,
goodsPrice: 7999,
startAt: +Date.now() + 100000000000,
endAt: +Date.now() + 1123190000,
activityStatus: 0,
rest: 1000,
tag: '秒杀',
id: 12,
isCheckRight: 1,
sales: 123,
discountType: 2,
discountValue: 8.8,
discountPrice: '11.1',
currentStock: 10
},
{
"goods_id": "342216279",
"title": "小伊",
"discount_type": "2",
"discount_value": "10",
"thumbUrl": "https://img.yzcdn.cn/upload_files/2017/06/23/FgfWom1XHvC8q3D8Iae0YweBncdQ.gif",
"stock_num": 1000,
"kdt_url": "https://h5.youzan.com/v2/showcase/goods?alias=2onuenmbrsj0l",
"price": "10.00",
"discount_price": "1.00",
activityPrice: 5999,
goodsPrice: 7999,
currentStock: 20,
startAt: Date.now(),
endAt: Date.now() + 100023312,
activityStatus: 1,
rest: 1000,
tag: '秒杀',
id: 12,
sales: 123,
discountType: 2,
discountValue: 8.8,
discountPrice: '11.1'
},
{
"goods_id": "342216279",
"title": "小伊",
"discount_type": "2",
"discount_value": "10",
"thumbUrl": "https://img.yzcdn.cn/upload_files/2017/06/23/FgfWom1XHvC8q3D8Iae0YweBncdQ.gif",
"stock_num": 1000,
"kdt_url": "https://h5.youzan.com/v2/showcase/goods?alias=2onuenmbrsj0l",
"price": "10.00",
"discount_price": "1.00",
activityPrice: 5999,
goodsPrice: 7999,
currentStock: 20,
startAt: Date.now(),
endAt: Date.now() + 1000012,
activityStatus: 1,
rest: 1000,
tag: '秒杀',
id: 12,
sales: 123,
discountType: 2,
discountValue: 8.8,
discountPrice: '11.1'
}
]
}
}
}
</script>
## UmpSeckill 秒杀活动组件
### 使用指南
#### 使用 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) (推荐)
```javascript
import { UmpSeckill } from 'captain-ui';
```
### 代码演示
#### 基本用法
:::demo 基本用法
```html
<cap-ump-seckill
:goods-list="goodsList"
:size="0"
:buy-btn-type="0"
:activity-status="0"
:show-title="1"
:show-stock-num="1"
:show-buy-btn="1"
:activity-status="1"
:image-fill-style="2"
ratio="3,2"
/>
```
:::
:::demo 基本用法
```html
<cap-ump-seckill
:goods-list="goodsList"
:size="0"
:buy-btn-type="0"
:activity-status="0"
:show-title="1"
:show-stock-num="0"
:show-buy-btn="1"
:activity-status="1"
:image-fill-style="1"
ratio="3,2"
/>
```
:::
:::demo 基本用法
```html
<cap-ump-seckill
:goods-list="goodsList"
:size="0"
:buy-btn-type="0"
:activity-status="0"
:show-title="1"
:show-stock-num="0"
:show-buy-btn="1"
:activity-status="1"
:image-fill-style="1"
ratio="1,1"
/>
```
:::
:::demo 基本用法
```html
<cap-ump-seckill
:goods-list="goodsList"
:size="1"
:buy-btn-type="0"
:activity-status="0"
:show-title="1"
:show-stock-num="1"
:show-buy-btn="1"
:activity-status="1"
ratio="3,2"
/>
```
:::
:::demo 基本用法
```html
<cap-ump-seckill
:goods-list="goodsList"
:size="2"
:buy-btn-type="0"
:activity-status="0"
:show-title="1"
:show-stock-num="0"
:show-buy-btn="1"
:activity-status="1"
ratio="3,2"
/>
```
:::
:::demo 基本用法
```html
<cap-ump-seckill
:goods-list="goodsList"
:size="2"
:buy-btn-type="0"
:activity-status="0"
:show-title="1"
:show-stock-num="1"
:show-buy-btn="1"
:activity-status="1"
ratio="3,2"
/>
```
:::
### API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|-----------|-----------|-----------|-------------|-------------|
| goodsList | 活动商品列表 | `array` | [] | |
| size | 列表展示类型 | `number` | | 0 \| 1 \| 2 |
| ratio | 主图宽高比例 | `string` | '1,1' | '1,1' \| '2,3' |
| showCountdown | 是否展示倒计时 | `number` | 1 | 0 \| 1 |
| showBuyBtn | 是否展示购买按钮 | `number` | 1 | 0 \| 1 |
| showTitle | 是否展示标题 | `number` | 1 | 0 \| 1 |
| showStockNum | 是否展示库存 | `number` | 1 | 0 \| 1 |
| buyBtnType | 按钮风格 | `number` | 0 | 0 \| 1 \| 2 \| 3 |
| imageFillStyle | 主图填充类型 | `number` | 2 | 1 \| 2 |
| isPreview | 是否预览,pc预览用 | `boolean` | false | true \| false |
#### goodsList数据结构
```js
[
{
id: 'xxx', // 商品id
title: 'xxxx', // 商品标题
tag: 'xxx', // 活动名称
thumbUrl: 'xxxx',// 商品图
detailUrl: 'xxx', //商品链接
currentStock: 'xxx', // 库存数
goodsPrice: 'xxx', // 商品价格
activityPrice: 'xxx', // 活动价格
isCheckRight: 'xxx', // 是否需要预约
activityStatus: 'xxx', // 活动状态
stockNum: 'xxx', // 库存
startAt: 'xxx', //活动开始时间
endAt: 'xxx', // 活动结束时间
},
...
]
```