搜尋

首頁  >  問答  >  主體

javascript - antDesign的table column最後一次載入的時候this是undefined 怎麼回事

const { mode, status, startDate, endDate, keyword, payStatus, sellerDistributorId,showBatchAdd,selectedRowKeys} = this.state;
        const modelType = window.sessionStorage.getItem('NAV_TYPE') || 'UP';
        //上游模式的Columns
        const upModeColumns = [{
            title: '订单号',
            dataIndex: 'code'
        }, {
            title: '下单日期',
            dataIndex: 'orderDate',
            //className: 'column-time',
            //render(text) {
            //    return new Date(Number(text)).Format("YYYY-MM-dd hh:mm");
            //},
        }, {
            title: '客户名称',
            dataIndex: 'sellerDistributorName',
        }, {
            title: '订单类型',
            dataIndex: 'typeStr',
            render(data, row, index) {
                return <span>{row.upTypeStr}</span>
            }
        }, {
            title: '总金额',
            dataIndex: 'totalPrice'
        }, {
            title: '已收款',
            dataIndex: 'paidFund'
        },{
            title: '订单状态',
            dataIndex: 'statusStr',
            render(data, row, index) {
                //订购单,状态为"新建"的订单,显示为"待审核". 并且标红显示
                return <span style={ row.status == 1? { color: 'red'} : null}>{  row.status == 1? "待审核" : row.statusStr}</span>
            }
        }, {
            title: '付款状态',
            dataIndex: 'payStatusStr',
            render: (data, row) => {
                let style = row.payStatus == 1? {color: 'red'} : null;
                return <span style={style}>{row.payStatusStr}</span>
            },
        }, {
            title: '操作',
            dataIndex: 'operation',
            // fixed: 'right',
            // width: 100,
            render(data, row, index) {
                const idUrl = `/orderDetail/${row.id}/${row.type}`;
                return <span className="operation">
                            <Popconfirm placement="left" title='确定要完成收款吗?' onConfirm={this.handleFinishFlow.bind(this, row.id,row)}>
                                <a href="javascript:void(0)">完成</a>
                            </Popconfirm>
                            <Link to={idUrl}>详情</Link>
                       </span>
            }
        }];
   

為什麼column的this是undefined呢?

#
阿神阿神2749 天前625

全部回覆(1)我來回復

  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:38:44

    不知道你的handleFinishFlow是怎麼寫的,可以把onConfirm={this.handleFinishFlow.bind(this, row.id,row)} 改成onConfirm={()=>this.handleFinishFlow(row.id,row )}試試看

    回覆
    0
  • 取消回覆