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’;//上游模式的Columnsconst 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: ’訂單狀態(tài)’, dataIndex: ’statusStr’, render(data, row, index) {//訂購單,狀態(tài)為'新建'的訂單,顯示為'待審核'. 并且標紅顯示return <span style={ row.status == 1? { color: ’red’} : null}>{ row.status == 1? '待審核' : row.statusStr}</span> }}, { title: ’付款狀態(tài)’, 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呢?
問題解答
回答1:并不知道你的handleFinishFlow是怎么寫的,可以把onConfirm={this.handleFinishFlow.bind(this, row.id,row)} 改成 onConfirm={()=>this.handleFinishFlow(row.id,row)}試試看
相關(guān)文章:
1. python文檔怎么查看?2. android - NavigationView 的側(cè)滑菜單中如何保存新增項(通過程序添加)3. java - 怎么處理前臺要展示,但是數(shù)據(jù)庫表沒有該字段的實體類冗余屬性呢?4. javascript - ios返回不執(zhí)行js怎么解決?5. javascript - vue 元素加樣式該怎么做6. 除了 python2 和 python3,ipython notebook 還可以用哪些內(nèi)核?7. 這段代碼既不提示錯誤也看不到結(jié)果,請老師明示錯在哪里,謝謝!8. mysql - 怎么生成這個sql表?9. 提示語法錯誤語法錯誤: unexpected ’abstract’ (T_ABSTRACT)10. tp5 不同控制器中的變量調(diào)用問題
