antd vue upload这个回调参数传参怎么用

@preview="handPreview"可以传额外的参数吗

<template slot="upload" slot-scope="text, record">
 <a-upload
  name="file"
  :multiple="true"
  action="/api/common/upload"
  :headers="headers"
  :value="text"
  v-if="record.editable"
  @change="handleChange"
  @preview="handPreview(record)"

</template>

    handPreview (file, record) {
      console.log(file)
      console.log(record) // 请问这边怎么接到参数
    },
阅读 3.1k
2 个回答

官方文档上只写了一个参数,如果真的有多个参数,

@preview="handPreview(record)"
改为
@preview="handPreview"

修改后,handPreview中的console.log(record)还是没有值或值不为record信息,则表示组件中未抛出该参数
图片.png

<template slot="upload" slot-scope="text, record,index">
<a-upload
name="file"
:multiple="true"
action="/api/common/upload"
:headers="headers"
:value="text"
v-if="record.editable"
@change="handleChange"
@preview="handPreview($event, index)"

</template>

handPreview (e, index) {
  console.log(e)
  console.log(index)
},
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题