antd日期选择器怎么拿到值

用的antd vue,代码是下面这样,我只有dateChange不传参数,才能通过dateString拿到我想要的值,但是我想record,index和dateString同时拿到,因为日期选择器每行都有,我得知道是哪行触发了日期选择器,求各位大神们解惑

     <template slot="dateedit"  slot-scope="text, record, index" >
      <a-date-picker  @change="dateChange" />
     </template>
  dateChange(date, dateString) {
      console.log(date, dateString )
    } //拿值
阅读 3.7k
1 个回答

用 call 或者 apply, 以下 ...arguments 用来展开原始事件收到的参数

<template slot="dateedit"  slot-scope="text, record, index" >
  <a-date-picker  @change="dateChange.call(this, ...arguments, 自定义参数1, 自定义参数2)" />
</template>

// or 

<template slot="dateedit"  slot-scope="text, record, index" >
  <a-date-picker  @change="dateChange.apply(this, [...arguments, 自定义参数1, 自定义参数2])" />
</template>

对应的事件代码:

dateChange(date, dateString, 自定义参数1, 自定义参数2) {
  // ...
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题