优化了黑白主题切换

This commit is contained in:
曙光 2024-09-29 21:46:02 +08:00
parent e5a030dd33
commit c62ce6cb39
6 changed files with 28 additions and 10 deletions

11
src/assets/style.css Normal file
View File

@ -0,0 +1,11 @@
:root {
--primary-color: #0055ff; /* 亮色主题主色 */
--background-color: #ffffff; /* 亮色背景 */
--text-color: #333333; /* 亮色文字颜色 */
}
.dark-theme {
--primary-color: #0a65cc; /* 暗色主题主色 */
--background-color: #1e1e1e; /* 暗色背景 */
--text-color: #ffffff; /* 暗色文字颜色 */
}

View File

@ -1,5 +1,5 @@
<template> <template>
<div > <div style=" background-color: var(--background-color);color: var(--text-color);">
<a-row id="globalHeader" align="center" :wrap="false"> <a-row id="globalHeader" align="center" :wrap="false">
<a-col flex="auto"> <a-col flex="auto">
<a-menu <a-menu
@ -118,6 +118,7 @@ let mode=ref(1)
const drak=()=>{ const drak=()=>{
mode.value=0 mode.value=0
document.body.setAttribute('arco-theme', 'dark') document.body.setAttribute('arco-theme', 'dark')
document.body.classList.add('dark-theme'); //
// // // //
// document.body.removeAttribute('arco-theme'); // document.body.removeAttribute('arco-theme');
@ -125,6 +126,7 @@ document.body.setAttribute('arco-theme', 'dark')
const day=()=>{ const day=()=>{
mode.value=1 mode.value=1
// // // //
document.body.classList.remove('dark-theme'); //
document.body.removeAttribute('arco-theme'); document.body.removeAttribute('arco-theme');
} }
const logout=async()=>{ const logout=async()=>{

View File

@ -942,7 +942,7 @@
<router-view /> <router-view />
</a-layout-content> </a-layout-content>
<!-- 底部 --> <!-- 底部 -->
<a-layout-footer class="footer">By 曙光 shuguangwl.com</a-layout-footer> <a-layout-footer class="footer" style=" background-color: var(--background-color);color: var(--text-color);">By 曙光 shuguangwl.com</a-layout-footer>
</a-layout> </a-layout>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -4,7 +4,7 @@ import store from "./store";
import ArcoVue from "@arco-design/web-vue"; import ArcoVue from "@arco-design/web-vue";
import App from "./App.vue"; import App from "./App.vue";
import "@arco-design/web-vue/dist/arco.css"; import "@arco-design/web-vue/dist/arco.css";
import axios from 'axios' import '@/assets/style.css'
import '@/access' import '@/access'
// 额外引入图标库 // 额外引入图标库
import ArcoVueIcon from '@arco-design/web-vue/es/icon'; import ArcoVueIcon from '@arco-design/web-vue/es/icon';

View File

@ -4,7 +4,7 @@
<link rel="stylesheet" type="text/css" href="https://auth.idcbook.com/template/assets/home/shiwaiyun/static/common.css"> <link rel="stylesheet" type="text/css" href="https://auth.idcbook.com/template/assets/home/shiwaiyun/static/common.css">
<link rel="stylesheet" type="text/css" href="https://auth.idcbook.com/template/assets/home/shiwaiyun/static/index.css"> <link rel="stylesheet" type="text/css" href="https://auth.idcbook.com/template/assets/home/shiwaiyun/static/index.css">
<div style=" background-color: var(--background-color);color: var(--text-color);">
<!-- 页面主要内容 --> <!-- 页面主要内容 -->
<div> <div>
<!-- banner 菜单开始 --> <!-- banner 菜单开始 -->
@ -90,7 +90,7 @@
<!-- 优势部分结束 --> <!-- 优势部分结束 -->
<!-- 开始使用部分 --> <!-- 开始使用部分 -->
<div class="start-box"> <div class="start-box" style=" background-color: var(--background-color);color: var(--text-color);">
<div class="auto-width join-apy-wrap sm-p-lr-15"> <div class="auto-width join-apy-wrap sm-p-lr-15">
<div class="text-content" layout-align="space-between center"> <div class="text-content" layout-align="space-between center">
<div class="bdr-5 font-size-18 font-weight-bold"> <div class="bdr-5 font-size-18 font-weight-bold">
@ -158,6 +158,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -306,7 +307,7 @@ const handleCancel = () => {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
text-align: center; text-align: center;
background-color: #ffffff; background-color: var(--background-color);
border-radius: 5px; border-radius: 5px;
border: solid 1px #05f; border: solid 1px #05f;
color: #05f; color: #05f;

View File

@ -120,7 +120,8 @@ const paginationProps=reactive({
margin: 0 4px; margin: 0 4px;
} }
.header { .header {
background: #ffffff; background-color: var(--background-color);
color: var(--text-color);
padding: 0 20px; padding: 0 20px;
display: flex; display: flex;
align-items: center; align-items: center;
@ -141,17 +142,20 @@ const paginationProps=reactive({
} }
.sidebar { .sidebar {
background: #ffffff; background-color: var(--background-color);
color: var(--text-color);
border-radius: 8px; border-radius: 8px;
} }
.post-list { .post-list {
background: #ffffff; background-color: var(--background-color);
color: var(--text-color);
border-radius: 8px; border-radius: 8px;
} }
.footer { .footer {
text-align: center; text-align: center;
padding: 10px; padding: 10px;
background: #ffffff; background-color: var(--background-color);
color: var(--text-color);
} }
</style> </style>