在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ Vue中使用element table數(shù)據(jù)選擇的問題

Vue中使用element table數(shù)據(jù)選擇的問題

1.選中表格 共需要消耗積分里面顯示出 選中 表格里面的消耗積分
2.取消選擇 之前所選的數(shù)值小時
3.多選 積分累加
4.去掉多選 積分減掉

<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="兌換個數(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>
 handleSelectionChange (val) {
      if (val) {
        this.selectedIds = val.map(item => {
          return item.price;
        });
      } else {
        console.log("dffdf");
      }
    },

handleSelectionChange 方法好像只是選中時候可以 取消選中之后沒有任何操作
應該怎么處理

回答
編輯回答
赱丅呿

1.handleSelectionChange回調(diào)函數(shù)里面參數(shù)就是當前選中的項,你可以重新定義一個變量貯存上一個狀態(tài),將兩個狀態(tài)進行比較,就可以判斷是選中增加,還是選中減少,從而對積分處理


handleSelectionChange(val) {
    this.multipleSelection = val;
  }

2.希望可以幫到你

2017年2月22日 00:09
編輯回答
澐染

可以詳細說說么

2018年1月1日 08:04