Webpack优化动态主题加载

This commit is contained in:
tangly1024
2023-06-20 14:20:43 +08:00
parent 16bdf3a745
commit c92fbafc39
29 changed files with 127 additions and 391 deletions

View File

@@ -1,5 +1,5 @@
import { useGlobal } from '@/lib/global'
import { saveDarkModeToCookies } from '@/lib/theme'
import { saveDarkModeToCookies } from '@/themes/theme'
const DarkModeButton = (props) => {
const { isDarkMode, updateDarkMode } = useGlobal()

View File

@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
import { useEffect, useState } from 'react'
import Select from './Select'
import { useGlobal } from '@/lib/global'
import { ALL_THEME } from '@/lib/theme'
import { ALL_THEME } from '@/themes/theme'
import { useRouter } from 'next/router'
/**
@@ -32,7 +32,7 @@ const DebugPanel = () => {
}
function handleUpdateDebugTheme(newTheme) {
console.log('触发切换主题', newTheme)
console.log('切换主题', newTheme)
const query = { ...router.query, theme: newTheme }
router.push({ pathname: router.pathname, query })
}

View File

@@ -1,7 +1,7 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import { Draggable } from './Draggable'
import { ALL_THEME } from '@/lib/theme'
import { ALL_THEME } from '@/themes/theme'
import { useRouter } from 'next/router'
/**
*
@@ -17,7 +17,6 @@ const ThemeSwitch = () => {
const newTheme = e.target.value
const query = router.query
query.theme = newTheme
console.log('切换主题', newTheme)
router.push({ pathname: router.pathname, query })
}