Pārlūkot izejas kodu

监听传值变化

lifanagju_citu 5 mēneši atpakaļ
vecāks
revīzija
e42fc9a1d7

+ 10 - 2
src/views/recruit/personal/PersonalCenter/resume/analysis/components/avatar.vue

@@ -23,7 +23,7 @@
 defineOptions({ name: 'resumeAnalysis-avatar'})
 import { getUserAvatar } from '@/utils/avatar'
 // import { blobToJson } from '@/utils'
-import { ref } from 'vue'
+import { ref, watch } from 'vue'
 const props = defineProps({
   id: {
     type: String,
@@ -63,7 +63,15 @@ const handleUploadFile = async (e) => {
   }
 }
 
-const avatarResult = ref(props.data)
+const avatarResult = ref('')
+
+watch(
+  () => props.data,
+  (newVal) => {
+    avatarResult.value = newVal
+  },
+  { immediate: true },
+)
 
 // 图片裁剪
 const handleHideCopper = async (res) => {