一、安装依赖
我们的项目支持换肤,主题色是在后台设置的,进入项目后会把主题色种到cookie里,其他子项目去cookie中拿就可以。
import './App.scss'
import React from 'react'
import { RouterProvider } from 'react-router-dom'
import { ConfigProvider } from 'antd'
import { routes } from '@/router/index'
import Cookie from 'js-cookie'
import { tenantId } from '@/utils/index'
function App() {
const customerColor = Cookie.get(`${tenantId}_color`)
return (
<ConfigProvider
theme={{
token: {
// Seed Token,影响范围大
colorPrimary: customerColor || '#2B1AE3',
colorLink: customerColor || '#2B1AE3',
},
}}
>
<RouterProvider router={routes} />
</ConfigProvider>
)
}
export default App