Skip to content

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

NameDescriptionTypeDefault
specsspecification dataSkuSpecItem[][]
skussku dataSkuItem[][]
sku-idcurrent selected sku-idstring-

Events

NameDescriptionParameters
changetriggered after the specification is selectedPick<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
}

Released under the MIT License.