feat: 暗色模式全站适配
- CSS变量体系 + dark class切换 - 全局Element Plus暗色覆盖 - 前台Home/后台AdminLayout/Login/404全部适配 - 日月图标切换按钮+localStorage持久化 - 手机端隐藏暗色开关
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<el-icon><Setting /></el-icon>
|
||||
后台管理
|
||||
</a>
|
||||
<el-button class="dark-toggle" @click="darkToggle" :icon="isDark ? 'Sunny' : 'Moon'" circle size="small" />
|
||||
<el-input
|
||||
v-model="search"
|
||||
placeholder="搜索网址..."
|
||||
@@ -70,6 +71,9 @@ import { ref, reactive, computed } from 'vue'
|
||||
import { Search, Setting } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { siteApi } from '@/api'
|
||||
import { useDarkMode } from '@/composables/useDarkMode'
|
||||
|
||||
const { isDark, toggle: darkToggle } = useDarkMode()
|
||||
|
||||
const data = reactive({ categories: [] as any[], settings: {} as any, links: [] as any[] })
|
||||
const search = ref('')
|
||||
@@ -282,6 +286,7 @@ loadData()
|
||||
padding: 6px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.dark-toggle { display: none; }
|
||||
}
|
||||
.main-content { padding: 16px; }
|
||||
.links-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
|
||||
@@ -289,4 +294,15 @@ loadData()
|
||||
.category-header .name { font-size: 16px; }
|
||||
.category-section { margin-bottom: 24px; }
|
||||
}
|
||||
|
||||
/* 暗色模式 */
|
||||
html.dark .home { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
|
||||
html.dark .header { background: var(--header-bg); box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
|
||||
html.dark .link-card { background: var(--bg-card); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
|
||||
html.dark .link-card:hover { box-shadow: 0 6px 16px rgba(99,102,241,0.3); }
|
||||
html.dark .link-desc { color: #64748b; }
|
||||
html.dark .category-header { border-bottom-color: var(--border-color); }
|
||||
html.dark .category-header .count { background: #334155; color: #94a3b8; }
|
||||
html.dark .footer { color: #475569; }
|
||||
html.dark .dark-toggle { color: #fbbf24 !important; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user