鍍金池/ 問答/HTML5  C++  HTML/ vue 的checkbox如何點擊選中時 獲取 該行數(shù)據(jù)

vue 的checkbox如何點擊選中時 獲取 該行數(shù)據(jù)

clipboard.png

回答
編輯回答
瘋浪

每行的數(shù)據(jù)應(yīng)該是v-for出來的吧? checkbox 有個change事件 綁定一個事件 傳入當(dāng)前對象就行了

<li v-for="todo in todos">
      <label>
        <input type="checkbox"
          v-on:change="toggle(todo)"
          v-bind:checked="todo.done">

        <del v-if="todo.done">
          {{ todo.text }}
        </del>
        <span v-else>
          {{ todo.text }}
        </span>
      </label>
    </li>
2017年6月19日 03:18
編輯回答
孤島

給input加一個事件

<template scope="scope">
     <div v-if="scope.row">
           <el-checkbox @change="getRow(scope.row)"  v-if="scope.row.platformUsername"></el-checkbox>
           <el-checkbox  disabled v-if="!scope.row.platformUsername"></el-checkbox>
     </div>
   </template>
                    
                    
                    
                    

不知道你用的是不是elementui的表格

2017年3月18日 07:32
編輯回答
壞脾滊

該列數(shù)據(jù)嗎?

2017年6月23日 14:27