为了账号安全,请及时绑定邮箱和手机立即绑定

changeCata 里面item不存在

food.js?58d1:34 Uncaught TypeError: Cannot read property 'pid' of undefined

    at eval (food.js?58d1:34)

    at Array.filter (<anonymous>)

    at Food.eval (food.js?58d1:34)

    at Food.clearCallBacks (index.js?36eb:1754)

    at updateComponent (index.js?36eb:1665)

    at rerender (index.js?36eb:1700)

changeCata(selectCata){

        this.setState({selectCata:selectCata});

        if(this.state.foodlist.some(item=>item.pid==selectCata.id)){

            //不用加载数据

          this.setState({currentlist:this.state.foodlist.filter(item=>item.pid==selectCata.id)})    

        }else{

            //需要加载数据

         this.setState({foodlist:this.state.foodlist.concat(this.getData(selectCata))},()=>{

             this.setState({currentlist:this.state.foodlist.filter(item=>item.pid==selectCata.id)}) 

         }) ;

        }

    }


正在回答

1 回答

举报

0/150
提交
取消

changeCata 里面item不存在

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信