fix: 修复头像组件内传值问题
This commit is contained in:
@@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import "vue-cropper/dist/index.css";
|
import "vue-cropper/dist/index.css";
|
||||||
import { ref, reactive, onMounted,computed } from "vue";
|
import { ref, reactive, onMounted,computed ,watch} from "vue";
|
||||||
import { VueCropper } from "vue-cropper";
|
import { VueCropper } from "vue-cropper";
|
||||||
import { upload } from "@/apis/fileApi";
|
import { upload } from "@/apis/fileApi";
|
||||||
import { updateUserIcon } from "@/apis/userApi";
|
import { updateUserIcon } from "@/apis/userApi";
|
||||||
@@ -242,13 +242,20 @@ const confirmImage = async () => {
|
|||||||
selectedImageIndex.value = null;
|
selectedImageIndex.value = null;
|
||||||
isOnlineVisible.value = false;
|
isOnlineVisible.value = false;
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
|
||||||
|
|
||||||
const userIcon=props.user.icon;
|
watch(
|
||||||
options.img=userIcon == "" || userIcon == null
|
() => props,
|
||||||
|
(val,oldValue) => {
|
||||||
|
const userIcon=props.user.icon;
|
||||||
|
console.log(userIcon,"userIcon")
|
||||||
|
options.img=userIcon == "" || userIcon == null
|
||||||
? "/acquiesce.png"
|
? "/acquiesce.png"
|
||||||
: import.meta.env.VITE_APP_BASEAPI + "/file/" + userIcon;
|
: import.meta.env.VITE_APP_BASEAPI + "/file/" + userIcon;
|
||||||
|
|
||||||
|
},
|
||||||
|
{immediate:true,deep:true}
|
||||||
|
);
|
||||||
|
onMounted(async () => {
|
||||||
const { data: iconListData } = await getIconList();
|
const { data: iconListData } = await getIconList();
|
||||||
iconList.value = iconListData.map(
|
iconList.value = iconListData.map(
|
||||||
(item) => import.meta.env.VITE_APP_BASEAPI + "/" + item
|
(item) => import.meta.env.VITE_APP_BASEAPI + "/" + item
|
||||||
|
|||||||
Reference in New Issue
Block a user