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

鍍金池/ 問(wèn)答/HTML/ vue 如何獲取input輸入框里面的值在別的方法里面用

vue 如何獲取input輸入框里面的值在別的方法里面用

<el-table :data="tableData" style="width: 100%;" @selection-change="handleSelectionChange" ref="multipleTable">
             <el-table-column align="center" type="selection" width="55" fixed></el-table-column>
        <el-table-column align="center" prop="name" label="方案名稱(chēng)" width='120'>
          <!-- <template slot-scope="scope">{{scope.row.beginCardNo}} - {{scope.row.endCardNo}}</template> -->
        </el-table-column>
        <el-table-column align="center" prop ="type" label="兌換類(lèi)型">
          <!-- <template slot-scope="scope">{{scope.row.cardTypeName}}</template> -->
        </el-table-column>
        <el-table-column align="center"  label="兌換個(gè)數(shù)" width="160px" prop ="exchangeNum">
          <template slot-scope="scope">
             <!-- <el-col :span="16"> -->
            <el-input placeholder="請(qǐng)輸入兌換個(gè)數(shù)" v-model="scope.row.exchangeNum" @change="change"></el-input>
             <!-- </el-col> -->
          </template>
        </el-table-column>
        <!--<el-table-column align="center" prop="" label="未配送數(shù)量"></el-table-column>-->
        <el-table-column align="center" label="消耗積分" prop="costPointsNum">
          <!-- <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>
<el-input placeholder="請(qǐng)輸入兌換個(gè)數(shù)" v-model="scope.row.exchangeNum" @change="change"></el-input>

clipboard.png

1.<el-input placeholder="請(qǐng)輸入兌換個(gè)數(shù)" v-model="scope.row.exchangeNum" @change="change"></el-input> 已經(jīng)v-model綁定了一個(gè) 數(shù)據(jù),那么應(yīng)該怎么寫(xiě)才能實(shí)現(xiàn) 兌換個(gè)數(shù)下的輸入框修改的同事,消耗積分下的數(shù)字就自動(dòng)更改 比如 修改成2 的時(shí)候 馬上變成20 不知道改怎么獲取input下的值 完成計(jì)算
求大神詳解

回答
編輯回答
夢(mèng)若殤

@change="change(scope.$index,$event)";

methods:{

change(index,e){
    const value = e.target.value;
    this.$set(this.tableData[index],'exchangeNum',value * 10) 
}

}

應(yīng)該是可行的

2018年9月11日 19:56
編輯回答
忠妾

通過(guò)計(jì)算屬性computed,vue實(shí)例獲取scope.row.exchangeNum的值,在計(jì)算屬性里計(jì)算后,也就是寫(xiě)個(gè)function返回這個(gè)值*10,然后綁定在消耗積分下面那個(gè)屬性上就好了

2017年4月7日 07:01
編輯回答
扯機(jī)薄
<el-table-column align="center"  label="兌換個(gè)數(shù)" width="160px" prop ="exchangeNum">
          <template slot-scope="scope">
             <!-- <el-col :span="16"> -->
            <el-input placeholder="請(qǐng)輸入兌換個(gè)數(shù)" v-model="scope.row.exchangeNum" @change="change"></el-input>
             <!-- </el-col> -->
          </template>
        </el-table-column>
        <el-table-column align="center" label="消耗積分" prop="costPointsNum">
           <template slot-scope="scope">{{scope.row.exchangeNum*10}}</template>
        </el-table-column>
2017年11月15日 01:33