slot-scope 插槽 的使用 ——'<template slot-scope="scope">'
代码:
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
icon="el-icon-delete" circle
@click="onDeleteArticle(scope.row.id)"></el-button>
</template>
slot-scope=“scope”
slot-scope 是一个插槽,拿外面的数据,可以获取当前一行的数据,scope是给他的命名,可以叫scope也可以根据个人自取名称。
scope.row.id拿到当前行数据的id。
注意:
slot-scope=“A” @click="onDeleteArticle(A.row.id)
名称须保持一致。