vue使用element的组件时想要在elementUI自定义的钩子函数种传递其他参数的解决办法

    xiaoxiao2022-07-06  212

    使用elementUI的Upload 上传组件时

    当删除图片时想要找到图片所在的数组对象中的index,需要在删除的钩子函数中(before-remove)传递index参数

    以下是elementUI的upLoad组件的一下钩子函数

    那么如何传递自己想要的参数呢?答案如下   回调再回调

    <template> <div class="sub-box subDetails"> <el-upload :before-remove="(file, fileList)=>beforeRemove(file, fileList,index)"> <span><i class="el-icon-plus" style="font-size:14px;"></i> 添加图片</span> </el-upload> </div> </template> <script> export default { methods:{ beforeRemove(file,fileList,position) {//删除之前 console.log(arguments) }, }, } </script>

     

    最新回复(0)