diff --git a/src/sku/README.md b/src/sku/README.md index c755223ea..466940569 100644 --- a/src/sku/README.md +++ b/src/sku/README.md @@ -267,11 +267,13 @@ sku: { id: 1222, name: 'Tea', price: 1, + text_status: 0, }, { id: 1223, name: 'Water', price: 1, + text_status: 1, }, ], }, diff --git a/src/sku/README.zh-CN.md b/src/sku/README.zh-CN.md index a4d69161c..ed7af115f 100644 --- a/src/sku/README.zh-CN.md +++ b/src/sku/README.zh-CN.md @@ -260,11 +260,13 @@ sku: { id: 1222, // 属性值id name: '珍珠', // 属性值名 price: 1, // 属性值加价 + text_status: 0, // 属性启用/禁用状态 0 - 禁用,1 - 启用 }, { id: 1223, name: '椰果', price: 1, + text_status: 1, }, ], }, diff --git a/src/sku/Sku.js b/src/sku/Sku.js index 320a86893..b1a0d6279 100644 --- a/src/sku/Sku.js +++ b/src/sku/Sku.js @@ -750,6 +750,7 @@ export default createComponent({ selectedProp={selectedProp} skuEventBus={skuEventBus} multiple={skuTreeItem.is_multiple} + disabled={skuValue.text_status === 0} /> ))} diff --git a/src/sku/components/SkuRowPropItem.js b/src/sku/components/SkuRowPropItem.js index 4336f2640..78a4a744b 100644 --- a/src/sku/components/SkuRowPropItem.js +++ b/src/sku/components/SkuRowPropItem.js @@ -9,6 +9,7 @@ export default createComponent({ skuEventBus: Object, selectedProp: Object, multiple: Boolean, + disabled: Boolean, }, computed: { @@ -25,6 +26,8 @@ export default createComponent({ methods: { onSelect() { + if (this.disabled) return; + this.skuEventBus.$emit('sku:propSelect', { ...this.skuValue, skuKeyStr: this.skuKeyStr, @@ -39,6 +42,7 @@ export default createComponent({ class={[ 'van-sku-row__item', { 'van-sku-row__item--active': this.choosed }, + { 'van-sku-row__item--disabled': this.disabled }, ]} onClick={this.onSelect} > diff --git a/src/sku/demo/data.ts b/src/sku/demo/data.ts index 2a3dc5f3b..e8ebb9b1b 100644 --- a/src/sku/demo/data.ts +++ b/src/sku/demo/data.ts @@ -216,6 +216,26 @@ export function getSkuData(largeImageMode = false) { }, ], }, + { + k: '有禁用的属性', + k_id: 127, + is_multiple: false, + is_necessary: false, + v: [ + { + id: 1271, + name: '禁用的属性', + price: 0, + text_status: 0, + }, + { + id: 1272, + name: '未禁用的属性', + price: 0, + text_status: 1, + }, + ], + }, ], }; }