From bbd6172da648ae8adb86749619c1c2f3cbb7a393 Mon Sep 17 00:00:00 2001 From: zhaojinfeng <121016171@qq.com> Date: Sun, 23 Jul 2023 12:39:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=84=E4=BB=B6=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/upload-avatar/index.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/upload-avatar/index.vue b/packages/upload-avatar/index.vue index 3c5821f..e99c8bf 100644 --- a/packages/upload-avatar/index.vue +++ b/packages/upload-avatar/index.vue @@ -226,14 +226,18 @@ function closeDialog() { reset() loading = false } - -watch(() => props.fileId, async () => { - if (!props.fileId || avatarUrl) +async function init() { + if (!props.fileId) { + avatarUrl = props.fileUrl return - + } const res = await props.fileFunction(props.fileId) avatarUrl = res.url -}) +} + +tryOnMounted(init) + +watch(() => props.fileId, init)