修复本地开发base标签问题,添加内联脚本提前移除
This commit is contained in:
11
.vscode/settings.json
vendored
Normal file
11
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"liveServer.settings.port": 5500,
|
||||
"liveServer.settings.root": "/",
|
||||
"liveServer.settings.CustomBrowser": "chrome",
|
||||
"liveServer.settings.NoBrowser": false,
|
||||
"liveServer.settings.ignoreFiles": [
|
||||
".git",
|
||||
"**/*.sass",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -527,3 +527,17 @@ body {
|
||||
.section-title {
|
||||
animation: fadeInUp 0.6s ease-out;
|
||||
}
|
||||
|
||||
.card-image placeholder-img img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
og-image.jpg img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
BIN
images/favicon.png
Normal file
BIN
images/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
BIN
images/气温和降水月平均分布.png
Normal file
BIN
images/气温和降水月平均分布.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
BIN
images/航拍图.png
Normal file
BIN
images/航拍图.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
15
index.html
15
index.html
@@ -21,6 +21,21 @@
|
||||
<!-- Base Path for Subdirectory Deployment -->
|
||||
<base href="/g2026/g4/">
|
||||
|
||||
<!-- Smart Path Detection - Must run before CSS/JS loading -->
|
||||
<script>
|
||||
(function() {
|
||||
const hostname = window.location.hostname;
|
||||
// 本地开发环境自动移除 base 标签
|
||||
if (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '') {
|
||||
const baseTag = document.querySelector('base');
|
||||
if (baseTag) {
|
||||
baseTag.remove();
|
||||
console.log('🔧 Local dev mode: base tag removed');
|
||||
}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- Stylesheet -->
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user