【修复】修复自建组件的问题

This commit is contained in:
zer0Black
2021-05-06 16:31:24 +08:00
parent 38ba2b705a
commit c830b7ba0e
11 changed files with 191 additions and 111 deletions
+14 -3
View File
@@ -13,7 +13,7 @@
:isMultiple="isMultiple"
:showUploadList="isMultiple"
v-bind="$attrs"
v-on="$listeners"
v-on="childListeners"
@change="handleChange"
@preview="handlePreview"
:class="!isMultiple?'imgupload':''">
@@ -84,6 +84,17 @@
}
//update-end-author:wangshuai date:20201021 for:LOWCOD-969 新增number属性,用于判断上传数量
},
computed: {
//透传给下级组件的事件,需要排除本组件使用的change事件
childListeners() {
const vm = this;
let result = Object.assign({},
this.$listeners,
)
delete result.change;
return result;
}
},
watch:{
value: {
handler(val,oldValue) {
@@ -194,7 +205,7 @@
if(arr.length>0){
path = arr.join(",")
}
this.$emit('image-change', path);
this.$emit('change', path);
},
handleDelete(file){
//如有需要新增 删除逻辑
@@ -209,7 +220,7 @@
},
model: {
prop: 'value',
event: 'image-change'
event: 'change'
}
}
</script>