mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(sku): 支持属性的禁用状态 (#11260)
This commit is contained in:
parent
0d54e9644d
commit
207e80c62c
@ -267,11 +267,13 @@ sku: {
|
||||
id: 1222,
|
||||
name: 'Tea',
|
||||
price: 1,
|
||||
text_status: 0,
|
||||
},
|
||||
{
|
||||
id: 1223,
|
||||
name: 'Water',
|
||||
price: 1,
|
||||
text_status: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -260,11 +260,13 @@ sku: {
|
||||
id: 1222, // 属性值id
|
||||
name: '珍珠', // 属性值名
|
||||
price: 1, // 属性值加价
|
||||
text_status: 0, // 属性启用/禁用状态 0 - 禁用,1 - 启用
|
||||
},
|
||||
{
|
||||
id: 1223,
|
||||
name: '椰果',
|
||||
price: 1,
|
||||
text_status: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -750,6 +750,7 @@ export default createComponent({
|
||||
selectedProp={selectedProp}
|
||||
skuEventBus={skuEventBus}
|
||||
multiple={skuTreeItem.is_multiple}
|
||||
disabled={skuValue.text_status === 0}
|
||||
/>
|
||||
))}
|
||||
</SkuRow>
|
||||
|
@ -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}
|
||||
>
|
||||
|
@ -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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user