layui上传图片如何获取本身this

研究很久!我们先来看看this输出的内容!

image.png

image.png

发现在item内!

那么我们可以在before内获取参数然后传入data

 before: function(obj) {
var oldname = this.item[0].name;
console.log(this.item[0].name);
this.data.oldname = oldname;
}

或者我们可以获取他的父级内容,来更新dom

 done: function(res) {
   var imgsrc=this.item.parents('li').find('.xh-img-src').attr('src');
   
}


相关内容

发表评论

验证码:
点击我更换图片

最新评论