Vux: XNumber change方法传参问题

Created on 1 Apr 2017  ·  1Comment  ·  Source: airyland/vux

Version

Android or iOS

For Android issues, please specify the brand, model and browser

Your Codes

<template>
  <div>
    <group title="服务" v-show="minfos">
      <x-number ref="fwref" v-for="app in minfos" :key="app.id" :title="app.pname" v-model="app.quant" button-style="round" :min="0"  @on-change="change"></x-number>
    </group>
  </div>
</template>

<script>
  import { Group, XNumber } from 'vux'

  export default {
    components: {
      XNumber,
      Group
    },
    data () {
      return {
        minfos: [
          {
            id: '1',
            pname: '项目1',
            price: 60.00,
            quant: 1
          },
          {
            id: '2',
            pname: '项目2',
            price: 30.00,
            quant: 2
          }
        ]
      }
    },
    methods: {
      change (val) {
        console.log(val)
      }
    }
  }
</script>

<style scoped lang="less">
</style>

你好,
在@on-change="change"中,如果不带参数的话,methods中的change方法中的val是XNumber的currentvalue,
如果带参数的话怎么在change方法中获取XNumber的currentvalue

<x-number ref="fwref" v-for="app in minfos" :key="app.id" :title="app.pname" v-model="app.quant" button-style="round" :min="0"  @on-change="change(app.id)"></x-number>

Most helpful comment

change(app.id, $event)

>All comments

change(app.id, $event)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RenShine picture RenShine  ·  4Comments

hezhiwen940420 picture hezhiwen940420  ·  4Comments

airyland picture airyland  ·  5Comments

525729985 picture 525729985  ·  4Comments

ty850454 picture ty850454  ·  3Comments