一個外賣軟件,用了element-ui,訂單用el-table顯示,表格每一列分別表示商品的名稱,數(shù)量,總價,現(xiàn)在想要實現(xiàn):用el-input-number動態(tài)修改數(shù)量時,商品的總價也會隨著改變。本來打算用watch監(jiān)聽表格綁定的數(shù)據(jù),但是百度了一下說vue無法監(jiān)聽數(shù)組的變化?于是我就有點不知所措了,求大神指教代碼 <el-table
:data="basket"
stripe
style="width: 100%"
>
<el-table-column
prop="name"
label="商品"
align="center"
></el-table-column>
<el-table-column
prop="num"
label="份數(shù)"
align="center"
>
<template slot-scope="scope" >
<el-input-number v-show="scope.row.num" size="mini" v-model="scope.row.num"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="price"
label="小計(元)"
align="center"
>
添加回答
舉報
0/150
提交
取消