fix:修复文章头像显示的bug

This commit is contained in:
Xwen
2023-12-24 21:26:04 +08:00
parent 15d9c272e0
commit 4d15d81c7e

View File

@@ -43,6 +43,8 @@
<script setup>
import useUserStore from "@/stores/user";
import { reactive, watch, onMounted, computed, ref } from "vue";
import { upload } from "@/apis/fileApi";
//userInfo
//{icon,name,role,id},根据判断userInfo是否等于未定义来觉得是当前登录用户信息还是其他人信息
const props = defineProps([
@@ -62,15 +64,16 @@ const userInfo = reactive({
userLimit: "",
});
const iconUrl = ref("/favicon.ico");
const iconUrlHandler = () => {
const iconUrlHandler = (icon) => {
if (
userInfo.icon == null ||
userInfo.icon == undefined ||
userInfo.icon == ""
) {
return "/favicon.ico";
} else {
return import.meta.env.VITE_APP_BASEAPI + "/file/" + icon;
}
return `/favicon.ico`;
};
watch(userStore, (n) => {