Commit 74459aff authored by 蒋佳奇's avatar 蒋佳奇

feat: tailwindcss兼容antd

parent 7af2c21d
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
}, },
"dependencies": { "dependencies": {
"@tailwindcss/vite": "^4.1.0", "@tailwindcss/vite": "^4.1.0",
"@tuia/eslint-config-common": "3.0.1-beta.2",
"antd": "^5.24.5", "antd": "^5.24.5",
"axios": "^1.8.4", "axios": "^1.8.4",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
...@@ -27,6 +26,7 @@ ...@@ -27,6 +26,7 @@
}, },
"devDependencies": { "devDependencies": {
"@ant-design/v5-patch-for-react-19": "^1.0.3", "@ant-design/v5-patch-for-react-19": "^1.0.3",
"@tuia/eslint-config-common": "3.0.1-beta.2",
"@types/numeral": "^2.0.5", "@types/numeral": "^2.0.5",
"@types/react": "^19.0.10", "@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4", "@types/react-dom": "^19.0.4",
......
import { Suspense } from 'react' import { Suspense } from 'react'
import { StyleProvider } from '@ant-design/cssinjs'
import routes from '~react-pages' import routes from '~react-pages'
import { ConfigProvider } from 'antd'
import Layouts from './layouts' import Layouts from './layouts'
const App: React.FC = () => { const App: React.FC = () => {
return ( return (
<Suspense fallback={<Spin fullscreen />}> <Suspense fallback={<Spin fullscreen />}>
<Layouts>{useRoutes(routes)}</Layouts> <StyleProvider layer>
<ConfigProvider>
<Layouts>{useRoutes(routes)}</Layouts>
</ConfigProvider>
</StyleProvider>
</Suspense> </Suspense>
) )
} }
......
@import "tailwindcss" @import "tailwindcss/utilities";
\ No newline at end of file @import "tailwindcss/theme";
/* @import "tailwindcss/preflight"; */
\ No newline at end of file
...@@ -21,15 +21,16 @@ const BasicLayout: React.FC<React.PropsWithChildren> = ({ children }) => { ...@@ -21,15 +21,16 @@ const BasicLayout: React.FC<React.PropsWithChildren> = ({ children }) => {
const navigate = useNavigate() const navigate = useNavigate()
return ( return (
<Layout style={{ minHeight: '100vh' }}> <Layout className='min-h-screen text-9xl'>
<Sider breakpoint='lg'> <Header className='p-0' />
<div className='demo-logo-vertical' />
<Menu theme='dark' mode='vertical' items={menuItems} onSelect={({ key }) => navigate(key)} />
</Sider>
<Layout> <Layout>
<Header style={{ padding: 0, background: colorBgContainer }} /> <Sider breakpoint='lg'>
<Content style={{ margin: '24px 16px 0' }}> <Menu theme='dark' mode='vertical' items={menuItems} onSelect={({ key }) => navigate(key)} />
<div style={{ padding: 24, background: colorBgContainer }}>{children}</div> </Sider>
<Content className='mt-6 mx-4'>
<div className='p-6' style={{ background: colorBgContainer }}>
{children}
</div>
</Content> </Content>
</Layout> </Layout>
</Layout> </Layout>
......
...@@ -3,11 +3,12 @@ import { createRoot } from 'react-dom/client' ...@@ -3,11 +3,12 @@ import { createRoot } from 'react-dom/client'
import { HashRouter } from 'react-router-dom' import { HashRouter } from 'react-router-dom'
import App from './App' import App from './App'
import './index.css'
import '@ant-design/v5-patch-for-react-19' import '@ant-design/v5-patch-for-react-19'
import 'antd/dist/reset.css' import 'antd/dist/reset.css'
import './index.css'
const app = createRoot(document.getElementById('root')!) const app = createRoot(document.getElementById('root')!)
app.render( app.render(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment