slot-scope="page"
slot-scope 是一个插槽,拿外面的数据,可以获取当前一行的数据
page.row.pageId 拿到当前行数据的pageId
注意:
slot-scope="A" @click="edit(B.row.pageId)
A和B需要保持一致
1 <el-table-column label="操作" width="300"> 2 <template slot-scope="page"> 3 <el-button 4 size="small" type="text" 5 @click="edit(page.row.pageId)">编辑 6 </el-button> 7 <el-button 8 size="small" type="text" 9 @click="del(page.row.pageId)">删除 10 </el-button> 11 <el-button 12 @click="preview(page.row.pageId)" 13 type="text" 14 size="small">页面预览 15 </el-button> 16 <el-button 17 size="small" type="primary" plain @click="postPage(page.row.pageId)">发布 18 </el-button> 19 </template> 20 </el-table-column>