Orion's Studio.

在el-table中使用el-input-number传值延迟

2017/12/05

要说的就这么多

1
2
3
4
5
6
7
8
9
10
11
12
<el-table ...>
...
<el-table-column ...>
<template scope="scope">
<div>
<el-input-number v-model="scope.row.quantity" @change="(value) => handleInput(value, scope.row.quantity)" ...>
</el-input-number>
</div>
</template>
</el-table-colum>
...
</el-table>
1
2
3
4
handleInput (value, quantity) {
console.log(value) // 真实值
console.log(quantity) // 前一个值
},

直接这样就没事

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<el-table ...>
...
<el-table-column ...>
<template scope="scope">
<div>
<el-input
v-model="scope.row.quantity" @change="handleInput(scope.row)" class="count-input" onkeypress="return event.keyCode>=48&&event.keyCode<=57">
<el-button slot="prepend" @click="del(scope.row)"><i class="el-icon-minus"></i></el-button>
<el-button slot="append" @click="add(scope.row)"><i class="el-icon-plus"></i></el-button>
</el-input>
</div>
</template>
</el-table-colum>
...
</el-table>
CATALOG
  1. 1. 要说的就这么多
  2. 2. 直接这样就没事