element-ui中的 slot-scope=“scope“

在表格中嵌套<template slot-scope="scope">,可以获得该表格中每当前行的各种属性
在这里插入图片描述

<template slot-scope="scope">
                <el-button
                    @click.native.prevent="addRow(scope.$index, tableData)" 
                    type="text"
                    size="small"
                    >增加</el-button>
            </template>
//获取当前行的下标scope.$index,如果你的行中有属性date或者name,
//那么可以直接使用scope.$date或者scope.$name
//scope只是个名字,你可以自己随意改

猜你喜欢

转载自blog.csdn.net/moasad/article/details/121462619