鍍金池/ 問答/HTML/ vue input雙向綁定的問題,實(shí)現(xiàn)同步計(jì)算

vue input雙向綁定的問題,實(shí)現(xiàn)同步計(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>

實(shí)現(xiàn)效果如圖:
選中單元格的數(shù)據(jù)之后 更改輸入框的值 更改的同事完成計(jì)算 消耗積分部分完成相應(yīng)的計(jì)算 要求同步

應(yīng)該怎么寫這個(gè)方法

exchangeNum 是來自后臺(tái)的參數(shù) 默認(rèn)1

回答
編輯回答
殘淚

監(jiān)聽input框的值的變化,發(fā)生變化時(shí),觸發(fā)驗(yàn)證和計(jì)算

2018年5月15日 08:56
編輯回答
拽很帥

貼個(gè)簡(jiǎn)單的代碼把

clipboard.png

或者計(jì)算屬性computed 一樣的邏輯 非常簡(jiǎn)單

2018年3月3日 15:13
編輯回答
尐潴豬
<el-table-column align="center"  label="消耗積分" width="160px">
          <template slot-scope="scope">
             {{scope.row.exchangeNum*1}}
          </template>
2017年9月27日 06:58