删除本页唯一数据后,自动跳到上一页

2019-10-31  本文已影响0人  家有饿犬和聋猫

let deletes =(batchNo)=>{
            // console.log('删除');
        conService.deleted(batchNo).then(
            rem => {
                if (rem.success) {

                    var listers = () => {
                        let bool = (Math.ceil(this.state.totalnum / 10) === this.state.currentPage) && this.state.currentPage > 1 && (this.state.totalnum % 10) === 1 && this.state.totalnum !== 1;
                        // console.log(' this.state.totalnum % 10, this.state.totalnum !== 1', this.state.currentPage, this.state.totalnum % 10, this.state.totalnum !== 1);
                        if (bool) {
                            this.setState({
                                currentPage: Number(this.state.currentPage) - 1
                            });
                        }
                    };
                     //在更新数据之前判断是否跳到上一页
                    this.upData(listers());

                } else {
                    message.info(rem.message);
                }
            }
        );

}


上一篇下一篇

猜你喜欢

热点阅读