Skip to content

Commit

Permalink
feat: hand update main logo
Browse files Browse the repository at this point in the history
  • Loading branch information
HongwuQz committed Mar 19, 2024
1 parent d9f52cf commit 0aa5eb5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="message">
<!-- Logo -->
<div class="logo">
<img class="logo-img" :src="siteLogo" alt="logo" />
<img class="logo-img" :src="siteLogo" @click="updateSiteLogo" alt="logo" />
<div :class="{ name: true, 'text-hidden': true, long: siteUrl[0].length >= 6 }">
<span class="bg">{{ siteUrl[0] }}</span>
</div>
Expand Down Expand Up @@ -31,10 +31,12 @@ import { Icon } from "@vicons/utils";
import { QuoteLeft, QuoteRight } from "@vicons/fa";
import { Error } from "@icon-park/vue-next";
import { mainStore } from "@/store";
import { getRandomKey } from "../utils";
const store = mainStore();
const mainLogoUrl = import.meta.env.VITE_SITE_MAIN_LOGO;
// 主页站点logo
const siteLogo = import.meta.env.VITE_SITE_MAIN_LOGO;
const siteLogo = ref(mainLogoUrl);
// 站点链接
const siteUrl = computed(() => {
const url = import.meta.env.VITE_SITE_URL;
Expand All @@ -47,6 +49,12 @@ const siteUrl = computed(() => {
return url.split(".");
});
const updateSiteLogo = () => {
const randomQuery = getRandomKey()
console.log('xxx')
siteLogo.value = `${mainLogoUrl}?v=${randomQuery}`;
};
// 简介区域文字
const descriptionText = reactive({
hello: import.meta.env.VITE_DESC_HELLO,
Expand Down
4 changes: 4 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './cursor'
export * from './debounce'
export * from './getTime'
export * from './randomKey'
3 changes: 3 additions & 0 deletions src/utils/randomKey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function getRandomKey() {
return Math.random().toString(36).substring(2);
}

0 comments on commit 0aa5eb5

Please sign in to comment.