在右侧操作栏添加按钮并将该行信息(id)传递到方法中

1.template中必须使用slot-scope="scope" 才能在方法handleCount中使用scope.row进行传参

 </template>
      <template slot="menu" slot-scope="scope">
        <el-button
          type="text"
          icon="el-icon-circle-plus-outline"
          size="small"
          @click="handleCount(scope.row)"
          >按钮名称
        </el-button>
      </template>

2.methods

 handleCount(row) {
     console.log(row.id);  //获取该行id
 },

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐