# kun-vue-sku

> vue sku

Latest version **1.0.2** (published 2020-08-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install kun-vue-sku
pnpm add kun-vue-sku
yarn add kun-vue-sku
bun add kun-vue-sku
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-08-04 |
| First published | 2020-04-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 239.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Guosugaz |
| Maintainers | sugaz |
| Keywords | vue, sku |

## Links

- npm: https://www.npmjs.com/package/kun-vue-sku
- npm.io page: https://npm.io/package/kun-vue-sku

## Dependencies (4)

- [vue](https://npm.io/package/vue.md) ^2.6.11
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) ^4.3.0
- [@babel/runtime-corejs3](https://npm.io/package/@babel/runtime-corejs3.md) ^7.9.2

## Recent versions

- 1.0.2 (latest) — 2020-08-04
- 1.0.1 — 2020-08-03
- 1.0.0 — 2020-04-14

## README

# Kun-Vue-Sku
> 用Vue实现了sku选择

## Demo
https://guosugaz.gitee.io/kun-vue-sku/

 ## 快速运行
 ###  1. 安装
 ```bash
npm install --save kun-vue-sku
```
```js
import Vue from 'vue';
import VueSku from 'kun-vue-sku';

Vue.use(VueSku);
```
 ###  2. 使用
 ```html
<VueSku 
    :specArr="specArr" 
    :defaultKey="defaultKey"
    storeKey="store"
    @get-goods="handleSelectGoods"
    @active-img="hanldeActiveImg"
/>
```

```js
export default {
    data() {
        return {
            defaultKey: ["id", "price", "store"],
            specArr: [
                {
                    id: 1,
                    price: 99,
                    store: 9,
                    颜色:
                        "粉色,https://inews.gtimg.com/newsapp_ls/0/12169344339_295195/0",
                    尺码: "小",
                    内存: "4g",
                },
                {
                    id: 2,
                    price: 99,
                    store: 9,
                    颜色: "粉色",
                    尺码: "小",
                    内存: "8g",
                },
                {
                    id: 3,
                    price: 33,
                    store: 99,
                    颜色: "粉色",
                    尺码: "大",
                    内存: "4g",
                },
                {
                    id: 4,
                    price: 99,
                    store: 9,
                    颜色: "黄色",
                    尺码: "小",
                    内存: "4g",
                },
                {
                    id: 5,
                    price: 14,
                    store: 99,
                    颜色: "蓝色",
                    尺码: "大",
                    内存: "8g",
                }
            ]
        };
    },
    methods: {
        // 获取选中的商品
        handleSelectGoods(goods) {
            console.log(goods);
        },
        // 获取点击有图片的商品
        hanldeActiveImg(goods) {
            console.log(goods);
        }
    }
};
```

### 参数

| Param | Type | Describe | default | Version |
| :------: | :------: | :------: | :------: | :-----: |
| specArr | Object[] | 商品数组,每个item必须有id | | |
| defaultKey | String[] | 非sku的字段，如id，price | | |
| storeKey | String | 库存的字段 | store |

### callback

| Event | Type | Describe | Version |
| :------: | :------: | :------: | :-----: |
| get-goods | Function  | 获取到商品时回调 | |
| active-img | Function | 点击带有图片的规格 | |

---
_Source: https://npm.io/package/kun-vue-sku · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
