鍍金池/ 問答/HTML/ 如何選取element table數(shù)據(jù)列表的某一列的數(shù)據(jù),在對(duì)應(yīng)的位置顯示

如何選取element table數(shù)據(jù)列表的某一列的數(shù)據(jù),在對(duì)應(yīng)的位置顯示

clipboard.png

 <el-table :data="tableData" style="width: 100%;" @selection-change="handleSelectionChange">
        <el-table-column align="center" type="selection" width="55" fixed></el-table-column>
        <el-table-column align="center" prop="" label="方案名稱">
          <!-- <template slot-scope="scope">{{scope.row.beginCardNo}} - {{scope.row.endCardNo}}</template> -->
        </el-table-column>
        <el-table-column align="center" label="兌換類型">
          <!-- <template slot-scope="scope">{{scope.row.cardTypeName}}</template> -->
        </el-table-column>
        <el-table-column align="center" prop="count" label="兌換個(gè)數(shù)"></el-table-column>
        <!--<el-table-column align="center" prop="" label="未配送數(shù)量"></el-table-column>-->
        <el-table-column align="center" label="消耗積分" prop="price">
          <!-- <template slot-scope="scope">{{scope.row.deposit | money}}</template> -->
        </el-table-column>
        <!-- <el-table-column align="center" label="操作" fixed="right">
          <template slot-scope="scope">
            <a class="operation" @click="deleteItem(scope.row)" v-authority="508003">刪除</a>
          </template>
        </el-table-column> -->
      </el-table>

選擇了某行數(shù)據(jù)之后 消耗積分里的數(shù)據(jù) 會(huì)顯示在 共需要消耗積分的上面
選擇是10的那一行 就顯示10
兩行都選擇了 就顯示 22

回答
編輯回答
孤巷

handleSelectionChange應(yīng)該可以獲取到行數(shù)據(jù)吧,直接使用來(lái)顯示就好了。若只有行號(hào),到tableData取到對(duì)應(yīng)行的數(shù)據(jù)就好了

2017年10月21日 04:01
編輯回答
歆久

handleSelectionChange(val){
console.log(val)
}
這個(gè)方法可以獲取到你所選中行的數(shù)據(jù)的。結(jié)果會(huì)是一個(gè)數(shù)組對(duì)象。
你只需要在handleSelectionChange寫一個(gè)累加的方法就行了。

2017年9月26日 02:45
編輯回答
青瓷

繼續(xù)求教問題!

2018年5月25日 17:28