-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 客户端缓存导致界面设置 Logo 不能正常显示 #7048
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,9 @@ export function initFavicon() { | |
</svg> | ||
`; | ||
goldLink = `data:image/svg+xml,${encodeURIComponent(svg)}`; | ||
link.href = favicon ? '/api/v1/images/favicon' : goldLink; | ||
link.href = favicon ? `/api/v1/images/favicon?t=${Date.now()}` : goldLink; | ||
} else { | ||
link.href = favicon ? '/api/v1/images/favicon' : '/public/favicon.png'; | ||
link.href = favicon ? `/api/v1/images/favicon?t=${Date.now()}` : '/public/favicon.png'; | ||
} | ||
document.head.appendChild(link); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 没有明显的错误或问题,代码已格式化并保持一致。看起来在处理图像链接时做了优化,并确保了兼容性和安全性的设置。 然而,在某些现代浏览器中可能需要添加异步加载逻辑(避免网络延迟)。此外,对于未找到的icon可以考虑使用一个默认图片作为替代品来提升用户体验。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,11 @@ | |
<template #main> | ||
<div style="text-align: center; margin-top: 20px"> | ||
<div style="justify-self: center" class="logo"> | ||
<img v-if="globalStore.themeConfig.logo" style="width: 80px" :src="'/api/v1/images/logo'" /> | ||
<img | ||
v-if="globalStore.themeConfig.logo" | ||
style="width: 80px" | ||
:src="`/api/v1/images/logo?t=${Date.now()}`" | ||
/> | ||
<PrimaryLogo v-else /> | ||
</div> | ||
<h3 class="description">{{ globalStore.themeConfig.title || $t('setting.description') }}</h3> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个代码似乎是一段Vue CLI自动生成的代码,没有明显的错误或问题。它的主要功能是展示一个带有主题Logo的大标题和描述。 然而,我不能对未修改的原始代码进行对比分析。你可以直接使用当前版本或最新发布的内容比较。对于现有的代码,如果你有任何更具体的需求或者想要改进的地方,请告诉我! |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个片段是 Vue.js 中的一个模板,它显示一个图标菜单中的一个 logo 图片,并在点击时改变图片。代码中有些地方可能存在一些问题或可优化的地方,我为您提供了一些建议:
const t = Date();
let src =
/api/v1/images/logo?t=${t}
;if (typeof img.src === 'string') {
src +=
&date="${parseInt(t)}"
;}