Skip to content

请问怎么让主页图标与网站图标不同 #183

Answered by MadisonWirtanen
lan1oc asked this question in Q&A
Discussion options

You must be logged in to vote

/src/components/Message/index.vue中观察到应该是第4-10行定义了主页图标的图片和其下的文本信息,其中图片为siteLogo
而在第39行代码const siteLogo = import.meta.env.VITE_SITE_LOGO;中观察到这里siteLogo被设置为.env文件中所定义的VITE_SITE_LOGO的值,同时VITE_SITE_LOGO也是被用作网站图标的变量,因此当修改它时主页图标和网站图标会同时变化。

如果需要设置主页的图标不同于网站图标,
首先修改/src/components/Message/index.vue的第39行,如改为const siteLogo = import.meta.env.VITE_SITE_ICON;
然后在.env文件中添加新变量,如在第9行写上VITE_SITE_ICON = "/images/icon/myicon.png",这里的myicon.png是你放在/image/icon/目录下的准备作为主页图标的图片,注意到原图标是256×256大小的,你或许可以将准备换用的图标改为相似大小以避免出现适配问题

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by imsyy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug 这有一只虫子
3 participants
Converted from issue

This discussion was converted from issue #169 on August 14, 2023 05:38.