组件中的事件,传入自定义参数

2019-12-21  本文已影响0人  nora_wang

使用element组件时,会遇到需要将自己自定义的参数,这时候直接将参数代入到事件中,会获取不到你所传的值,导致页面报错。

解决方法: (i)=>function(i,v)

                <el-upload
                        :show-file-list="false"
                        :on-success="(res,file)=>handleAvatarSuccess1(res,file,index)"
                        :before-upload="beforeAvatarUpload"
                        class="avatar-uploader"
                        action="#">
                  <img v-if="item.url" :src="item.url" class="avatar">
                  <i v-else class="el-icon-plus avatar-uploader-icon"/>
                </el-upload>
上一篇 下一篇

猜你喜欢

热点阅读