# Sku ### Intro Often used for commodity selection ### Install ```js import { createApp } from 'vue' import { Sku } from '@nutui/nutui' const app = createApp() app.use(Sku) ``` ### Basic Usage :::demo ```vue ``` ::: ### Not Sell :::demo ```vue ``` ::: ### Custom Stepper You can configure the maximum value and minimum value of the digital input box as required :::demo ```vue ``` ::: ### Custom Slots The default partition is divided into several areas, which are defined as slots that can be replaced as required :::demo ```vue ``` ::: ## API ### Props | Attribute | Description | Type | Default | | --- | --- | --- | --- | | v-model:visible | Whether to open popup | boolean | `false` | | sku | Sku data | Array | `[]` | | goods | Product Info | object | - | | stepper-max | Stepper max | string \| number | `99999` | | stepper-min | Stepper min | string \| number | `1` | | btn-options | Bottom button | Array | `[confirm]` | | btn-extra-text | Add text above button | string | - | | stepper-title | Stepper left text | string | `Buy Num` | | stepper-extra-text | The text between the stepper and the headline | Function \| boolean | `false` | | buy-text | Buy button text | string | `Buy It Now` | | add-cart-text | Add cart button text | string | `Add To cart` | | confirm-text | Confirm button text | string | `Confirm` | ### Events | Attribute | Description | Arguments | | --- | --- | --- | | select-sku | Emitted when select sku | {sku,skuIndex,parentSku,parentIndex} | | add | Emitted when click stepper add button | value | | reduce | Emitted when click stepper reduce button | value | | overLimit | Emitted when click stepper disabled button | value | | change-stepper | Emitted when click stepper change | value | | click-btn-operate | Emitted when click bottom button | {type:'confirm',value:'inputNumber value'} | | click-close-icon | Emitted when click close button | - | | click-overlay | Emitted when click mask | - | | close | Emitted when popup close | - | ### Slots The default partition is divided into several areas, which are defined as slots that can be replaced as required。 | Event | Description | | --- | --- | | sku-header | Custom header | | sku-header-price | Custom header price area | | sku-header-extra | Extra header area | | sku-select-top | Custom select top | | sku-select | Custom sku | | sku-stepper | Custom stepper | | sku-stepper-bottom | Custom stepper bottom | | sku-operate | Custom stepper bottom operation | ### goods Data Structure ```javascript goods:{ skuId:'', // Product ID price: "0", // Product Price imagePath: "", // Product Image } ``` ### sku Data Structure Each array index represents a specification category。Where,`list` represents the category value under the specification category。Each category value object includes:`name`、`id`、`active`、`disable` ```javascript sku: [ { id: 1, name: '颜色', list: [ { name: '亮黑色', id: 100016015112, active: true, disable: false }, { name: '釉白色', id: 100016015142, active: false, disable: false }, { name: '秘银色', id: 100016015078, active: false, disable: false }, { name: '夏日胡杨', id: 100009064831, active: false, disable: false }, { name: '秋日胡杨', id: 100009064830, active: false, disable: false } ] }, { id: 2, name: '版本', list: [ { name: '8GB+128GB', id: 100016015102, active: true, disable: false }, { name: '8GB+256GB', id: 100016015122, active: false, disable: false } ] }, { id: 3, name: '版本', list: [ { name: '4G(有充版)', id: 100016015103, active: true, disable: false }, { name: '5G(有充版)', id: 100016015123, active: false, disable: false }, { name: '5G(无充版)', id: 100016015104, active: true, disable: true }, { name: '5G(无充)质保换新版', id: 100016015125, active: false, disable: false } ] } ] ``` ## Theming ### CSS Variables The component provides the following CSS variables, which can be used to customize styles. Please refer to [ConfigProvider component](#/en-US/component/configprovider). | Name | Default Value | | --- | --- | | --nut-sku-item-border | _1px solid var(--nut-primary-color)_ | | --nut-sku-item-disable-line | _line-through_ | | --nut-sku-opetate-bg-default | _linear-gradient(90deg, var(--nut-primary-color), var(--nut-primary-color-end) 100%)_ | | --nut-sku-item-active-bg | _var(--nut-primary-color)_ | | --nut-sku-opetate-bg-buy | _linear-gradient(135deg,rgba(255, 186, 13, 1) 0%,rgba(255, 195, 13, 1) 69%,rgba(255, 207, 13, 1) 100%)_ | | --nut-sku-spec-height | _30px_ | | --nut-sku-spec-line-height | _var(--nut-sku-spec-height)_ | | --nut-sku-spec-font-size | _11px_ | | --nut-sku-spec-background | _rgba(242, 242, 242, 1)_ | | --nut-sku-spec-color | _var(--nut-black)_ | | --nut-sku-spec-margin-right | _12px_ | | --nut-sku-spec-padding | _0 18px_ | | --nut-sku-spec-title-font-weight | _bold_ | | --nut-sku-spec-title-font-size | _13px_ | | --nut-sku-spec-title-color | _var(--nut-black)_ | | --nut-sku-spec-title-margin-bottom | _18px_ | | --nut-sku-operate-btn-height | _54px_ | | --nut-sku-operate-btn-border-top | _0_ | | --nut-sku-operate-btn-item-height | _40px_ | | --nut-sku-operate-btn-item-line-height | _var(--nut-sku-operate-btn-item-height)_ | | --nut-sku-operate-btn-item-font-size | _15px_ | | --nut-sku-operate-btn-item-font-weight | _normal_ | | --nut-sku-product-img-width | _100px_ | | --nut-sku-product-img-height | _var(--nut-sku-product-img-width)_ | | --nut-sku-product-img-border-radius | _0_ |