3 回答

TA貢獻(xiàn)1820條經(jīng)驗 獲得超2個贊
可以給你的input上加上事件
// template 部分代碼
<el-input v-model="address.jine" @change="getAmount(index)" placeholder="請輸入內(nèi)容" class="inLine"></el-input>
// 給你寫個簡單列子 js方法 me.listAdress 這個是存放table的數(shù)組
getAmount (index) {
// 取得當(dāng)前下標(biāo)之前的參數(shù)
let me = this
let totalAmout = 0
debugger
for (let i = 0; i <= index; i++){
// 這邊可以計算結(jié)果出每行的結(jié)果
totalAmout += Number( me.listAdress[i].jine)
}
console.log(totalAmout)
},

TA貢獻(xiàn)1820條經(jīng)驗 獲得超9個贊
你的表格是v-for生成的嗎
<button @click="addnewTr"></button>
<tr v-for="(item,index) in trs" :key="index">
<td><input type="text"></td>
<td><input type="text"></td>
</tr>
tr=[...]
addnewTr(){
this.trs.push(..)
}
比如這樣
添加回答
舉報