Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/sites/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"github-markdown-css": "~5.1.0",
"highlight.js": "^11.5.1",
"marked": "^4.3.0",
"@vueuse/core": "^12.7.0",
"prismjs": "^1.28.0",
"sortablejs": "1.15.0",
"tailwindcss": "^3.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ onBeforeUnmount(() => {
}
}
// 暗黑主题
:global(html.dark-theme .pc-demo-container) {
:global(html.dark .pc-demo-container) {
background: #000;
}

Expand Down
8 changes: 8 additions & 0 deletions examples/sites/src/views/layout/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<div class="main-layout ti-hp100 ti-f-c ti-f-box-stretch">
<div class="content-layout ti-fi-1" :has-sider="!isFrame">
<div id="layoutSider" class="layout-sider" :class="{ 'saas-border': templateModeState.isSaas }" v-if="!isFrame">
<div style="padding: 10px 0; text-align: center">
<tiny-button :reset-time="0" type="info" @click="toggleDark()">{{ isDark ? 'dark' : 'light' }}</tiny-button>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the toggleDark() function is correctly handling the theme switch to avoid any potential UI inconsistencies.

</div>
<tiny-tree-menu
ref="treeMenuRef"
class="main-menu"
Expand Down Expand Up @@ -65,6 +68,7 @@ import { getWord, i18nByKey, appData, appFn, useApiMode, useTemplateMode } from
import useTheme from '@/tools/useTheme'
import FloatSettings from '@/views/components-doc/components/float-settings.vue'
import VersionTip from '@/views/components-doc/components/version-tip.vue'
import { useDark, useToggle } from '@vueuse/core'

export default defineComponent({
name: 'LayoutVue',
Expand Down Expand Up @@ -103,6 +107,8 @@ export default defineComponent({
const getTo = (route, key) => `${import.meta.env.VITE_CONTEXT}${allPath}${lang}/${theme}/${route}${key}`

const isThemeSaas = import.meta.env.VITE_TINY_THEME === 'saas'
const isDark = useDark()
const toggleDark = useToggle(isDark)

const changeLanguage = () => {
appFn.toggleLang()
Expand Down Expand Up @@ -191,6 +197,8 @@ export default defineComponent({
getWord,
i18nByKey,
isThemeSaas,
isDark,
toggleDark,
isShowFilter
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/base/dark-theme.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* prettier-ignore */
:root {
:root.dark {
/* 1.1品牌色 */

/* 品牌主色 */
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/base/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
@import './vars.less';
// @import './old-theme.less';
// @import './aurora-theme.less';
// @import './dark-theme.less';
@import './dark-theme.less';
@import './transition.less';
Loading