Browse Source
update im-admin-ui/src/components/ImageUpload/index.vue.
图片上传后需要将回调emit到父组件,父组件才能正确处理缩略图等事务
Signed-off-by: 老周 <zhouyu629@qq.com>
master
老周
1 year ago
committed by
Gitee
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with
2 additions and
1 deletions
-
im-admin-ui/src/components/ImageUpload/index.vue
|
|
|
@ -59,7 +59,7 @@ const props = defineProps({ |
|
|
|
}); |
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
|
|
|
const emit = defineEmits(['update:modelValue']); |
|
|
|
const emit = defineEmits(['update:modelValue', 'on-success']); |
|
|
|
|
|
|
|
const dialogImageUrl = ref(''); |
|
|
|
const dialogVisible = ref(false); |
|
|
|
@ -99,6 +99,7 @@ const handleBeforeUpload = (file: any) => { |
|
|
|
// 上传成功回调 |
|
|
|
const handleUploadSuccess = (res: any) => { |
|
|
|
if (res.code === 200) { |
|
|
|
emit('on-success', res.data); |
|
|
|
emit('update:modelValue', res.data.originUrl); |
|
|
|
} else { |
|
|
|
emit('update:modelValue', ''); |
|
|
|
|