onLeft(index,type) {
this.select = index;
this.list = [];
this.goTop();
if(this.allFood.length>0){
if(type=='0'){
this.list =this.allFood
}else{
this.list = this.allFood.filter(function(item){
return item.type == type;
}).map(item=>{
return item
})
}
}
},
商品页。根据左侧显示右边内容
最新推荐文章于 2025-12-17 16:41:30 发布
onLeft函数根据传入的索引(index)和类型(type)更新数据。它首先设置select值为index,清空list,然后滚动到顶部。如果allFood数组不为空,它会根据type进行过滤和映射操作,将结果赋值给list。当type为0时,list等于allFood;否则,list包含type匹配的食品对象。
4468

被折叠的 条评论
为什么被折叠?



