vant sku 商品规格未选中时提示未选中的必选属性
//自定义提示vant sku组件未选择中属性中的必选属性提示customSkuValidator: (value) => {
//未选属性
let selectedText = value.selectedText;
selectedText = selectedText.split(' ');
selectedText.shift();
//必选属性
let requiredAttributes = [];
for (let i = 0; i < value.propList.length; i++) {
if(value.propList.is_necessary){
requiredAttributes.push(value.propList.k);
}
}
//对比
let reminder = '请选择:';
selectedText.forEach(function(val) {
if(requiredAttributes.indexOf(val) > -1){
reminder += val+',';
}
});
reminder = reminder.substr(0, reminder.length - 1);
//return value.selectedText;
return reminder;
},
页:
[1]