Home  >  Q&A  >  body text

javascript - table custom template in elementUI changes the value of v-model in the change event in the component

<el-table-column prop="volume" label="成交数量" width="120">
           <template scope="scope">
                     <el-input v-model="scope.row.volume" placeholder='请输入' type="number" v-on:change="verificationRule"></el-input>
           </template>
  </el-table-column>
methods: {
          verificationRule(value){
            console.log(value);
          },
         }

When the value of the input value changes, how can the change event cause the corresponding scope.row.volume to change? Can anyone please give me some advice?

曾经蜡笔没有小新曾经蜡笔没有小新2672 days ago1043

reply all(2)I'll reply

  • 漂亮男人

    漂亮男人2017-06-26 10:52:24

    You can achieve two-way binding with v-model. Why do you need to use the change event?

    reply
    0
  • 巴扎黑

    巴扎黑2017-06-26 10:52:24

    v-modelAfter binding, changes in the input area will directly change the value of scope.row.volume. Similarly, changes in the value of scope.row.volume will also be reflected in the display of the input area, so it is No need to manually write change events

    reply
    0
  • Cancelreply