node.js - antdesign Table中的columns屬性怎么和組件關(guān)聯(lián)?
問題描述
const columns = [{ title: ’申報批次’, dataIndex: ’declareBatch’, sorter: true, /*render: name => `${name.first} ${name.last}`,*/ /*render:()=>count++,*/ width: ’18%’,}, { title: ’被考機構(gòu)’, dataIndex: ’admittedOrganization’, width: ’19%’,}, { title: ’申報截止日期’, dataIndex: ’dueDate’, width: ’12%’,},{ title: ’考核時間’, dataIndex: ’examinationDate’, render: (msg => ( <span>{msg[0]+’~’+msg[1]}</span> )), width: ’20%’,},{ title: ’狀態(tài)’, dataIndex: ’type’, render: msg => msg === ’待確認(rèn)’ ? <span style={{color:'green'}}>{msg}</span> : (msg==='待提交'?<span style={{color:'orange'}}>{msg}</span>:(msg==='待審批'?<span style={{color:'red'}}>{msg}</span>:<span>{msg}</span>)), width: ’10%’,},{ title: ’備注’, dataIndex: ’note’, width: ’10%’,},{ title: ’操作’, key: ’operation’, render: (text, record) => ( <span> <a><Popconfirm placement='topLeft' title={'確定要關(guān)閉該申報計劃嗎?'} onVisibleChange={this.onPopVisibleChange} onConfirm={this.onPopConfirm(record)} onCancel={this.onTableFootBatchAppointExpertClickCancel} visible={this.props.commonTableReduce.get(’popVisible’)}> 關(guān)閉</Popconfirm> </a> <span className='ant-pider'></span> <a><span id='check'>查看</span></a> </span>), width: ’12%’, } ];
上面是Table中引用的clumn,最后一欄的操作里的Popconfirm的onVisibleChange等方法怎么調(diào)用下方的方法?
let AppTable = React.createClass({ onPopConfirm(record){ this.props.examineSubmittedTableAction.onPopConfirm(record,this.props.notificationAction,Notification) }, onPopCancel(){ this.props.examineSubmittedTableAction.onPopCancel() }, onPopVisibleChange(){ this.props.examineSubmittedTableAction.onPopVisibleChange() },
然后是Table的代碼
<Table //rowSelection={this.rowSelection} columns={columns} rowKey={record => record.id}//特別注意,需要設(shè)置表格主鍵唯一id的名稱,以優(yōu)化react顯示 dataSource={commonTableReduce.get(’data’).toJSON()} pagination={false} loading={commonTableReduce.get(’loading’)} onChange={this.handleTableChangePrepare} onRowClick= {this.onRowClick} size='middle' ref='tableRef'
我網(wǎng)站打開發(fā)現(xiàn)clumn里的this是undefined
那我改怎么寫,或是哪里有問題?
問題解答
回答1:把 columns 放到類里面去。
相關(guān)文章:
1. 為什么我ping不通我的docker容器呢???2. java - 自己制作一個視頻播放器,遇到問題,用的是內(nèi)置surfaceview類,具體看代碼!3. 服務(wù)器端 - 采用nginx做web服務(wù)器,C++開發(fā)應(yīng)用程序 出現(xiàn)拒絕連接請求?4. javascript - 有什么兼容性比較好的辦法來判斷瀏覽器窗口的類型?5. 關(guān)于docker下的nginx壓力測試6. javascript - vue 移動端的input 數(shù)字輸入優(yōu)化7. javascript - Angular controlller控制域和原生js的關(guān)系8. javascript - npm start 運行’webpack-dev-server’報錯 Cannot find module ’webpack’9. HTML5禁止img預(yù)覽該怎么解決?10. python - pandas按照列A和列B分組,將列C求平均數(shù),怎樣才能生成一個列A,B,C的dataframe
