这个问题是因为antd/lib/time-picker/style/index.js路径不再存在于Antd 5.0.4版本中。解决方案是将import from 'antd/lib/time-picker/style/index.js' 改成 import from 'antd/lib/time-picker/style/css.js',并在相应的css文件中引入antd的样式。
代码示例:
import React from 'react'; import { TimePicker } from 'antd'; import 'antd/dist/antd.css';
const App = () => {
return (
<>
export default App;
下一篇:Antd: 侧边菜单带有子菜单。