Sku
Stock Keeping Unit Component.
Basic Usage
Use only product data for rendering. spec
is specification data, skus
is sku data.
Choose Sku
Initialization The change
event is triggered after the specification is selected according to skuId
and the full specification is selected.
API
Attributes
Name | Description | Type | Default |
---|---|---|---|
specs | specification data | SkuSpecItem[] | [] |
skus | sku data | SkuItem[] | [] |
sku-id | current selected sku-id | string | - |
Events
Name | Description | Parameters |
---|---|---|
change | triggered after the specification is selected | Pick<SkuItem, 'specs'> |
Types
ts
export type SkuSpecItemValue = {
name: string
picture?: string
selected?: boolean
disabled?: boolean
}
export type SkuSpecItem = {
name: string
values: SkuSpecItemValue[]
}
export type SkuSpecItemPick = {
name: string
valueName: string
}
export type SkuItem = {
id: string
skuCode: string
price: string
oldPrice: string
inventory: number
specs: SkuSpecItemPick[]
specsText?: string
}
export type SkuSpecItemValue = {
name: string
picture?: string
selected?: boolean
disabled?: boolean
}
export type SkuSpecItem = {
name: string
values: SkuSpecItemValue[]
}
export type SkuSpecItemPick = {
name: string
valueName: string
}
export type SkuItem = {
id: string
skuCode: string
price: string
oldPrice: string
inventory: number
specs: SkuSpecItemPick[]
specsText?: string
}