这种遍历出来的表格,怎么保证每个表格的按钮只控制当前表格呢。
<div v-for="item in JOINTITLE">
<el-button @click="addDynamic">添加el-button>
<el-table :data="tableData" stripe border style="width: 50%">
<el-table-column :label="item"> el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
icon="el-icon-top"
circle
type="primary"
@click="moveUp(scope.$index, scope.row)"
>el-button>
<el-button
icon="el-icon-bottom"
circle
type="primary"
@click="moveDown(scope.$index, scope.row)"
>el-button>
<el-button icon="el-icon-close" circle type="danger">el-button>
template>
el-table-column>
el-table>
div>
给绑定的事件都加一个 参数 传 当前的 id 、和数据。如果是 表格里的按钮 得传 表格的id和 当前行的id.根据这个 改变数据
不是有scope.$index,数组下标。确定点击数据的下标在剪切插入
这种建议将循环出来的部分逻辑独立成一个组件。