fix:修复vite打包小图片丢失的坑

This commit is contained in:
Xwen
2023-12-15 00:48:17 +08:00
parent 849b8d0322
commit 3d4368544f
4 changed files with 4 additions and 4 deletions

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -50,14 +50,14 @@ const userInfo = reactive({
role: [],
id: "",
});
const iconUrl = ref("../../src/assets/common/icons/logo.ico");
const iconUrl = ref("/logo.ico");
const iconUrlHandler = () => {
if (
userInfo.icon == null ||
userInfo.icon == undefined ||
userInfo.icon == ""
) {
return "../../src/assets/common/icons/logo.ico";
return "/logo.ico";
}
return `${import.meta.env.VITE_APP_BASEAPI}/file/${userInfo.icon}`;
};

View File

@@ -45,7 +45,7 @@ const useUserStore = defineStore("user", {
const user = res.user;
const avatar =
user.icon == "" || user.icon == null
? "../../src/assets/common/icons/logo.ico"
? "/logo.ico"
: import.meta.env.VITE_APP_BASEAPI + "/file/" + user.icon;
if (res.roleCodes && res.roleCodes.length > 0) {
// 验证返回的roles是否是一个非空数组

View File

@@ -39,7 +39,7 @@ export default defineConfig(({ command, mode }) => {
},
// 增加新的配置
build: {
assetsInlineLimit: 1,
assetsInlineLimit: 0,
},
};
});