fix: 组件初始化问题

This commit is contained in:
2023-07-23 12:39:30 +08:00
parent 40f4449070
commit bbd6172da6

View File

@ -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)
</script>
<style>