太原做網(wǎng)站聯(lián)系方式近三天新聞50字左右
在使用element UI Table組件時,需要點(diǎn)擊取當(dāng)前行索引,并刪除當(dāng)前行,看了element UI 文檔好象沒有這個的,仔細(xì)看下發(fā)現(xiàn)當(dāng)前行索引是在scope
里的$.index
里。
element UI文檔:https://www.uihtm.com/element/#/zh-CN/component/table
代碼:
<el-table :data="tableData">
<el-table-column prop="HDBUReportSubCode" label="Product Name" width="180" fixed="left"><template slot-scope="scope">{{scope.row.name}} <i class="el-icon-delete" @click="delRow(scope.$index)"></i></template></el-table-column>
</el-table>....
//這樣就可以刪除行數(shù)據(jù)
delRow(index){this.tableData.splice(index,1);},
....