-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68a26f3
commit efbfb72
Showing
19 changed files
with
742 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<router-view /> | ||
</template> | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import MermaidUtils from '@/util/MermaidUtils'; | ||
export default defineComponent({ | ||
setup() { | ||
}, | ||
created() { | ||
// 设置默认主题 | ||
const theme = localStorage.getItem('system::theme'); | ||
if (theme == 'dark') { | ||
this.$store.commit('setIsDarkMode', true); | ||
document.body.setAttribute('theme', 'dark'); | ||
document.documentElement.classList.add('dark'); | ||
MermaidUtils.initWithDark() | ||
} | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<el-container> | ||
<el-header> | ||
<el-affix> | ||
<mobile-header /> | ||
</el-affix> | ||
</el-header> | ||
<el-main> | ||
<router-view /> | ||
</el-main> | ||
</el-container> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import MobileHeader from './components/header/mobile/MobileHeader.vue' | ||
export default defineComponent({ | ||
components: { | ||
MobileHeader | ||
}, | ||
setup() { | ||
}, | ||
}) | ||
</script> | ||
|
||
|
||
<style lang="less" scoped> | ||
.el-main { | ||
padding: 0 4px; | ||
} | ||
.el-header { | ||
padding: 0; | ||
height: 40px; | ||
} | ||
body[theme=dark] { | ||
.el-main { | ||
background-color:var(--main-dark-bg-color); | ||
color: var(--main-dark-text-color); | ||
} | ||
.el-header { | ||
background-color:var(--main-dark-bg-color); | ||
color: var(--main-dark-text-color); | ||
} | ||
.header-toggle-button { | ||
.el-button { | ||
box-shadow: 2px 2px 13px #111; | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<template> | ||
<el-switch | ||
v-model="showMode" | ||
:inline-prompt="true" | ||
:active-icon="Moon" | ||
:inactive-icon="Sunny" | ||
@click="toggleDarkMode" | ||
active-color="#000" | ||
inactive-color="#409EFF" | ||
> | ||
</el-switch> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import {Sunny, Moon } from '@element-plus/icons-vue'; | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
import MermaidUtils from '@/util/MermaidUtils'; | ||
export default defineComponent({ | ||
setup() {}, | ||
data() { | ||
return { | ||
showMode: false as boolean, | ||
} | ||
}, | ||
computed: { | ||
isDark(){ | ||
return this.$store.state.isDarkMode; | ||
} | ||
}, | ||
created() { | ||
this.showMode = this.isDark; | ||
}, | ||
methods: { | ||
toggleDarkMode(){ | ||
const theme = document.body.getAttribute('theme'); | ||
if (theme == 'dark') { | ||
document.body.setAttribute('theme', 'light'); | ||
document.documentElement.classList.remove("dark"); | ||
this.$store.commit('setIsDarkMode', false); | ||
localStorage.setItem('system::theme', "light"); | ||
MermaidUtils.initWithNormal(); | ||
}else { | ||
document.body.setAttribute('theme', 'dark'); | ||
document.documentElement.classList.add("dark"); | ||
this.$store.commit('setIsDarkMode', true); | ||
localStorage.setItem('system::theme', "dark"); | ||
MermaidUtils.initWithNormal(); | ||
} | ||
}, | ||
} | ||
}); | ||
</script> | ||
|
||
|
||
<style lang="less" scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<template> | ||
<div class="header"> | ||
<div class="header-wrapper"> | ||
<div class="container"> | ||
<div class="logo"> | ||
<el-link href="#" @click.prevent="$router.push('/home')"> | ||
{{ siteName }} | ||
</el-link> | ||
</div> | ||
<theme-switcher /> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import ThemeSwitcher from '../ThemeSwitcher.vue'; | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import config from "@/config"; | ||
export default defineComponent({ | ||
setup() { | ||
}, | ||
computed: { | ||
siteName() { | ||
return config.siteName; | ||
}, | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.header { | ||
height: 40px; | ||
padding: 0; | ||
box-shadow: var(--el-box-shadow); | ||
background-color:#fff; | ||
} | ||
.header-wrapper { | ||
padding: 8px; | ||
} | ||
.container { | ||
display: flex; | ||
justify-content: space-between; | ||
.logo { | ||
display: flex; | ||
align-items: center; | ||
a { | ||
text-decoration: none; | ||
font-size: 1rem; | ||
font-weight: 600; | ||
position: relative; | ||
} | ||
} | ||
} | ||
body[theme=dark] { | ||
.header { | ||
background-color:var(--second-dark-bg-color); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export{} // 必须保留 | ||
declare module '@vue/runtime-core' { | ||
interface ComponentCustomProperties { | ||
$isMobile: () => true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.