wangxxxx111
wangxxxx111
采纳率0%
2021-03-05 10:53

如何把我选中的元素从我数组集合中删掉

已结题
componentWillReceiveProps(nextProps){
    if(this.props.parentid!== nextProps.parentid||this.props.keyword!== nextProps.keyword){
        this.getsymptomData(nextProps.parentid,nextProps.keyword,nextProps.checked)
    }
    if(this.state.selectItemArray&&nextProps.selectItemArray){
        let array = this.state.selectItemArray;
        let e =  nextProps.selectItemArray;
        if (e.target.checked){
            console.log("不变",e.target.value);
        }else{
            array.remove(e.target.value);
            console.log("删除",e.target.value);

        }
        console.log("this.state.selectItemArray",this.state.selectItemArray);
        console.log("nextProps.selectItemArray", nextProps.selectItemArray);
        // if(this.props.selectItemArray!== nextProps.selectItemArray){
            this.setState({selectItemArray:array})
        // }
    }
  • 点赞
  • 收藏
  • 复制链接分享

1条回答

  • KingJordon console.log( ) 1月前

    splice 

    点赞 评论 复制链接分享

为你推荐