添加配置项
This commit is contained in:
parent
8f46b8dd46
commit
ddda08c037
6
.env
6
.env
@ -1,8 +1,14 @@
|
|||||||
# 站点名称
|
# 站点名称
|
||||||
VITE_SITE_NAME = "無名の主页"
|
VITE_SITE_NAME = "無名の主页"
|
||||||
|
VITE_SITE_ANTHOR = "無名"
|
||||||
|
VITE_SITE_KEYWORDS = "無名,个人主页"
|
||||||
|
VITE_SITE_DES = "一个默默无闻的主页"
|
||||||
VITE_SITE_URL = "imsyy.top"
|
VITE_SITE_URL = "imsyy.top"
|
||||||
VITE_SITE_LOGO = "/images/icon/logo.png"
|
VITE_SITE_LOGO = "/images/icon/logo.png"
|
||||||
|
|
||||||
|
# 百度统计(若不需要可不填)
|
||||||
|
VITE_SITE_BAIDUTONGJI = "14e9f35ff8bc67fd4bcb5f07a6e6655a"
|
||||||
|
|
||||||
# 简介文本
|
# 简介文本
|
||||||
VITE_DESC_HELLO = "Hello World !"
|
VITE_DESC_HELLO = "Hello World !"
|
||||||
VITE_DESC_TEXT = "一个建立于 21 世纪的小站,存活于互联网的边缘"
|
VITE_DESC_TEXT = "一个建立于 21 世纪的小站,存活于互联网的边缘"
|
||||||
|
@ -33,13 +33,16 @@
|
|||||||
|
|
||||||
* **安装** [node.js](https://nodejs.org/zh-cn/) **环境**
|
* **安装** [node.js](https://nodejs.org/zh-cn/) **环境**
|
||||||
|
|
||||||
> node > 16.16.0
|
> node > 16.16.0
|
||||||
> npm > 8.15.0
|
> npm > 8.15.0
|
||||||
|
|
||||||
* 然后以 **管理员权限** 运行 `cmd` 终端,并 `cd` 到 项目根目录
|
* 然后以 **管理员权限** 运行 `cmd` 终端,并 `cd` 到 项目根目录
|
||||||
* 在 `终端` 中输入:
|
* 在 `终端` 中输入:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# 安装 yarn
|
||||||
|
npm install -g yarn
|
||||||
|
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
yarn install
|
yarn install
|
||||||
|
|
||||||
|
10
index.html
10
index.html
@ -6,9 +6,9 @@
|
|||||||
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
||||||
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> -->
|
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> -->
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="description" content="一个默默无闻的主页" />
|
<meta name="description" content="<%- description %>" />
|
||||||
<meta name="keywords" content="無名,个人主页" />
|
<meta name="keywords" content="<%- keywords %>" />
|
||||||
<meta name="author" content="無名" />
|
<meta name="author" content="<%- author %>" />
|
||||||
<meta name="theme-color" content="#424242" />
|
<meta name="theme-color" content="#424242" />
|
||||||
<title><%- title %></title>
|
<title><%- title %></title>
|
||||||
<!-- HarmonyOS Sans -->
|
<!-- HarmonyOS Sans -->
|
||||||
@ -24,16 +24,18 @@
|
|||||||
window.location.href =
|
window.location.href =
|
||||||
"https://support.dmeng.net/upgrade-your-browser.html?referrer=" + encodeURIComponent(window.location.href)
|
"https://support.dmeng.net/upgrade-your-browser.html?referrer=" + encodeURIComponent(window.location.href)
|
||||||
</script>
|
</script>
|
||||||
|
<% if (tongji) { %>
|
||||||
<!-- 百度统计 -->
|
<!-- 百度统计 -->
|
||||||
<script>
|
<script>
|
||||||
var _hmt = _hmt || [];
|
var _hmt = _hmt || [];
|
||||||
(function () {
|
(function () {
|
||||||
var hm = document.createElement("script");
|
var hm = document.createElement("script");
|
||||||
hm.src = "https://hm.baidu.com/hm.js?14e9f35ff8bc67fd4bcb5f07a6e6655a";
|
hm.src = "https://hm.baidu.com/hm.js?<%- tongji %>";
|
||||||
var s = document.getElementsByTagName("script")[0];
|
var s = document.getElementsByTagName("script")[0];
|
||||||
s.parentNode.insertBefore(hm, s);
|
s.parentNode.insertBefore(hm, s);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
<% } %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="loading">
|
<body class="loading">
|
||||||
|
@ -18,9 +18,14 @@
|
|||||||
"icon": "/images/icon/email.png",
|
"icon": "/images/icon/email.png",
|
||||||
"tip": "来封 Email ~",
|
"tip": "来封 Email ~",
|
||||||
"url": "mailto:one@imsyy.top"
|
"url": "mailto:one@imsyy.top"
|
||||||
|
}, {
|
||||||
|
"name": "Twitter",
|
||||||
|
"icon": "/images/icon/twitter.png",
|
||||||
|
"tip": "你懂的 ~",
|
||||||
|
"url": "https://twitter.com/iimmsyy"
|
||||||
}, {
|
}, {
|
||||||
"name": "Telegram",
|
"name": "Telegram",
|
||||||
"icon": "/images/icon/telegram.png",
|
"icon": "/images/icon/telegram.png",
|
||||||
"tip": "你懂的 ~",
|
"tip": "你懂的 ~",
|
||||||
"url": "https://twitter.com/iimmsyy"
|
"url": "https://t.me/bottom_user"
|
||||||
}]
|
}]
|
@ -18,7 +18,7 @@
|
|||||||
@onSelectSong="onSelectSong"
|
@onSelectSong="onSelectSong"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { MusicOne, PlayWrong } from "@icon-park/vue-next";
|
import { MusicOne, PlayWrong } from "@icon-park/vue-next";
|
||||||
import aplayer from "vue3-aplayer";
|
import aplayer from "vue3-aplayer";
|
||||||
@ -114,13 +114,6 @@ onMounted(() => {
|
|||||||
playListCount.value = res.length;
|
playListCount.value = res.length;
|
||||||
// 更改播放器加载状态
|
// 更改播放器加载状态
|
||||||
store.musicIsOk = true;
|
store.musicIsOk = true;
|
||||||
console.log(
|
|
||||||
"音乐加载完成",
|
|
||||||
res,
|
|
||||||
playIndex.value,
|
|
||||||
playListCount.value,
|
|
||||||
props.volume
|
|
||||||
);
|
|
||||||
// 生成歌单
|
// 生成歌单
|
||||||
res.forEach((v) => {
|
res.forEach((v) => {
|
||||||
playList.value.push({
|
playList.value.push({
|
||||||
@ -131,6 +124,13 @@ onMounted(() => {
|
|||||||
lrc: v.lrc,
|
lrc: v.lrc,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
console.log(
|
||||||
|
"音乐加载完成",
|
||||||
|
playList.value,
|
||||||
|
playIndex.value,
|
||||||
|
playListCount.value,
|
||||||
|
props.volume
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
store.musicIsOk = false;
|
store.musicIsOk = false;
|
||||||
@ -213,8 +213,8 @@ const changeSong = (type) => {
|
|||||||
// 暴露子组件方法
|
// 暴露子组件方法
|
||||||
defineExpose({ playToggle, changeVolume, changeSong });
|
defineExpose({ playToggle, changeVolume, changeSong });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang="scss" scoped>
|
||||||
.aplayer {
|
.aplayer {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@ -296,4 +296,4 @@ defineExpose({ playToggle, changeVolume, changeSong });
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -14,4 +14,11 @@ const pinia = createPinia();
|
|||||||
pinia.use(piniaPluginPersistedstate);
|
pinia.use(piniaPluginPersistedstate);
|
||||||
|
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
||||||
|
// PWA
|
||||||
|
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
||||||
|
// 弹出更新提醒
|
||||||
|
console.log("站点已更新,刷新后生效");
|
||||||
|
ElMessage("站点已更新,刷新后生效");
|
||||||
|
})
|
@ -36,6 +36,10 @@ export default ({
|
|||||||
inject: {
|
inject: {
|
||||||
data: {
|
data: {
|
||||||
title: loadEnv(mode, process.cwd()).VITE_SITE_NAME,
|
title: loadEnv(mode, process.cwd()).VITE_SITE_NAME,
|
||||||
|
author: loadEnv(mode, process.cwd()).VITE_SITE_ANTHOR,
|
||||||
|
keywords: loadEnv(mode, process.cwd()).VITE_SITE_KEYWORDS,
|
||||||
|
description: loadEnv(mode, process.cwd()).VITE_SITE_DES,
|
||||||
|
tongji: loadEnv(mode, process.cwd()).VITE_SITE_BAIDUTONGJI,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -46,6 +50,8 @@ export default ({
|
|||||||
navigateFallbackAllowlist: [/^index.html$/]
|
navigateFallbackAllowlist: [/^index.html$/]
|
||||||
},
|
},
|
||||||
workbox: {
|
workbox: {
|
||||||
|
skipWaiting: true,
|
||||||
|
clientsClaim: true,
|
||||||
runtimeCaching: [{
|
runtimeCaching: [{
|
||||||
urlPattern: /(.*?)\.(js|css|woff2|woff|ttf)/, // js / css 静态资源缓存
|
urlPattern: /(.*?)\.(js|css|woff2|woff|ttf)/, // js / css 静态资源缓存
|
||||||
handler: 'CacheFirst',
|
handler: 'CacheFirst',
|
||||||
@ -63,9 +69,9 @@ export default ({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
manifest: {
|
manifest: {
|
||||||
"name": "無名の主页",
|
"name": loadEnv(mode, process.cwd()).VITE_SITE_NAME,
|
||||||
"short_name": "無名の主页",
|
"short_name": loadEnv(mode, process.cwd()).VITE_SITE_NAME,
|
||||||
"description": "一个默默无闻的主页",
|
"description": loadEnv(mode, process.cwd()).VITE_SITE_DES,
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"start_url": "/",
|
"start_url": "/",
|
||||||
"theme_color": "#424242",
|
"theme_color": "#424242",
|
||||||
|
Loading…
Reference in New Issue
Block a user