完整版:http://www.javashuo.com/article/p-tjqzzumw-cc.htmlpost
需求又變了,說是讓選中也能夠進行實時刷新,又網上找了下,發現大佬寫法:http://www.javashuo.com/article/p-risyvwhh-dn.htmlui
其實element ui 官網就有寫法,仍是要多看看文檔-0.0-.net
官網是說3d
代碼爲blog
<!-- stripe--啓用馬紋線 border--啓用邊框 highlight-current-row--啓用單選 sortable--啓用排序--> <el-table ref="multipleTable" :data="tables.slice((currentPage-1)*pagesize,currentPage*pagesize)" stripe border highlight-current-row tooltip-effect="dark" style="width: 100%;font-size: 13px" :cell-style="{padding:'0px'}" @row-click="rowClick" :row-style="rowStyle" :row-class-name="rowClassName" @selection-change="handleSelectionChange" :row-key="getRowKeys"> <el-table-column sortable :reserve-selection="true" type="selection" width="55"></el-table-column> <el-table-column sortable prop="test" label="test" show-overflow-tooltip></el-table-column> <el-table-column sortable prop="test" label="test" show-overflow-tooltip></el-table-column> <el-table-column sortable prop="test" label="test" show-overflow-tooltip></el-table-column> <el-table-column sortable prop="test" label="testtest" show-overflow-tooltip></el-table-column> <el-table-column sortable prop="test" label="test" show-overflow-tooltip></el-table-column> </el-table>
須要加入代碼已加粗加下劃線 這個不能直接reserve-selection="true"這樣寫排序
會報錯Invalid prop: type check failed for prop "reserveSelection". Expected Boolean, got String with value "true".ip
錯誤大體爲須要一個boolean類型的參數,可是傳入爲String類型的須要加上 :reserve-selection="true"element
還有要返回一個當前行標識文檔
// 指定返回的行 getRowKeys(row){ return row.id; },