关于#vue.js#的问题:想要拿到一行的数据

想要拿到一行的数据
问题相关代码,请勿粘贴截图
'scope' is defined but never used
我的解答思路和尝试过的方法
vue项目正常运行
      <!-- 用户列表区域 -->
      <el-table :data="userlist" border stripe>
        <el-table-column type="index"></el-table-column>
        <el-table-column label="姓名" prop="username"></el-table-column>
        <el-table-column label="邮箱" prop="email"></el-table-column>
        <el-table-column label="电话" prop="mobile"></el-table-column>
        <el-table-column label="角色" prop="role_name"></el-table-column>
        <el-table-column label="状态">
          <template slot-scope="scope">
            <el-switch v-model="scope.row.mg_state" @change="userStateChanged(scope.row)">
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="180px">
          <template slot-scope="scope">
            <!-- 修改按钮 -->
            <el-button type="primary" icon="el-icon-edit" size="mini"></el-button>
            <!-- 删除按钮 -->
            <el-button type="danger" icon="el-icon-delete" size="mini"></el-button>
            <!-- 分配角色按钮 -->
            <el-tooltip effect="dark" content="分配角色" placement="top" :enterable="false">
              <el-button type="warning" icon="el-icon-setting" size="mini"></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>

你的作用域插槽,按钮显示那里,不需要scope的话就去掉,只写slot-scope

'scope' is defined but never used
是eslint的警告
可以在15行前面加上
//eslint-disable-next-line
就可以忽略警告(前面的两条杠也要加上,本质是注释)

img

用不到的话可以不用声明,要不会报错