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() reset()
loading = false loading = false
} }
async function init() {
watch(() => props.fileId, async () => { if (!props.fileId) {
if (!props.fileId || avatarUrl) avatarUrl = props.fileUrl
return return
}
const res = await props.fileFunction(props.fileId) const res = await props.fileFunction(props.fileId)
avatarUrl = res.url avatarUrl = res.url
}) }
tryOnMounted(init)
watch(() => props.fileId, init)
</script> </script>
<style> <style>