mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 09:24:25 +00:00
docs(Sku): add docs and change the usage of properties (#5563)
This commit is contained in:
@@ -11,7 +11,14 @@ import SkuStepper from './components/SkuStepper';
|
||||
import SkuMessages from './components/SkuMessages';
|
||||
import SkuActions from './components/SkuActions';
|
||||
import { createNamespace, isDef } from '../utils';
|
||||
import { isAllSelected, isSkuChoosable, getSkuComb, getSelectedSkuValues, getSelectedPropValues } from './utils/skuHelper';
|
||||
import {
|
||||
isAllSelected,
|
||||
isSkuChoosable,
|
||||
getSkuComb,
|
||||
getSelectedSkuValues,
|
||||
getSelectedPropValues,
|
||||
getSelectedProperties,
|
||||
} from './utils/skuHelper';
|
||||
import { LIMIT_TYPE, UNSELECTED_SKU_VALUE_ID } from './constants';
|
||||
|
||||
const namespace = createNamespace('sku');
|
||||
@@ -38,6 +45,7 @@ export default createComponent({
|
||||
disableStepperInput: Boolean,
|
||||
safeAreaInsetBottom: Boolean,
|
||||
resetSelectedSkuOnHide: Boolean,
|
||||
properties: Array,
|
||||
quota: {
|
||||
type: Number,
|
||||
default: 0
|
||||
@@ -185,7 +193,7 @@ export default createComponent({
|
||||
};
|
||||
}
|
||||
if (skuComb) {
|
||||
skuComb.properties = this.selectedPropValues;
|
||||
skuComb.properties = getSelectedProperties(this.propList, this.selectedProp);
|
||||
skuComb.property_price = this.selectedPropValues.reduce((acc, cur) => acc + (cur.price || 0), 0);
|
||||
}
|
||||
}
|
||||
@@ -220,7 +228,7 @@ export default createComponent({
|
||||
},
|
||||
|
||||
propList() {
|
||||
return this.sku.properties || [];
|
||||
return this.properties || [];
|
||||
},
|
||||
|
||||
imageList() {
|
||||
|
Reference in New Issue
Block a user