import { Row, Col, Card } from 'antd'
import { color } from 'utils'
import { Page } from 'components'
import {App} from '../components/dash'
import App2 from '../components/People'
//import styles from './index.less'
const bodyStyle = {
bodyStyle: {
height: 443,
background: '#fff',
},
}
上述代码会报如下的错误:
./src/pages/hospitalUser/blb/index.js
45:25-28 '../components/dash' does not contain an export named 'App'.
很明显,这是无法引入相关的组件。我已经反复检查了,在dash里面我已经导出了该App,而且没有任何问题。仔细检查了路径,也是没有任何问题的。很气,所以重新写了一个其他组件。然后就导入成功了。组件也美美的出现了。
仔细对比发现,原来是在引入App的时候在其名称外面添加了 大括号{ }。
去掉就没有了。很弱智。暂时气到还没理清楚原因。先记录一下,消消气。
正确写法:
import { Page } from 'components'
import App from '../components/dash'
import App2 from '../components/People'
//import styles from './index.less'
const bodyStyle = {
bodyStyle: {
height: 443,
background: '#fff',
},
注意,消失了的大括号。