不是很能理解umi的这个配置式路由 #8901
Replies: 2 comments
|
// 以下是./base/enterprise.js import React, {useEffect, useRef, useMemo} from 'react'; const Enterprise = () => { const isAdmin = localStorage.getItem('token').split('.=')[1] === 'admin' const { initialState, loading, error, refresh, setInitialState } = useModel('@@initialstate'); const {showModify, showDelete} = useMemo(() => { }, [initialState]) useEffect(() => { }) // https://procomponents.ant.design/components/schema/#valuetype let actionRef = useRef(); const onDeleteItem = id => { return ( ) // export default connect(({enterprise}) => ({enterprise}))(Enterprise) |
Uh oh!
There was an error while loading. Please reload this page.
版本:3.5.0
问题:ant-design-pro项目配置routes
···JavaScript
{
path: '/',
name: '基础资料',
exact: true,
redirect: '/enterprise',
indexRoute: './base/enterprise',
component: './base/a',
// layout: false,
// https://pro.ant.design/zh-CN/docs/layout/#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%B8%83%E5%B1%80
routes: [
{
path: 'enterprise',
name: '企业管理',
exact: true,
icon: '',
component: './base/enterprise',
},
{
path: '/entaccount',
name: '账户管理',
exact: true,
icon: '',
component: './base/entaccount',
},
]
},
···
结果:页面报错,Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of
LoadableComponent.看大意是组件文件没有返回react组件,可是我确定已经返回了
All reactions