第一次使用 Chakra 并尝试在 Chakra UI 中将默认字体更改为 Times New Roman 但没有效果。是否导入,分配新主题,将其作为道具传递给 ChakraProvider 但代码中没有任何反应
index.js
import {extendTheme, ChakraProvider} from "@chakra-ui/react"
const customTheme = {
fonts: {
body: 'Times New Roman, sans-serif',
heading: 'Times New Roman, sans-serif',
mono: 'Times New Roman, sans-serif', }
const theme = extendTheme({customTheme})
ReactDOM.render(
<React.StrictMode>
<ChakraProvider theme={theme}>
<App/>
</ChakraProvider>
</React.StrictMode>,
document.getElementById('root')
);
我的文本组件似乎没有改变
import {Text} from '@chakra-ui/react'
<Text> Some text </Text>