reactjs - 为什么无法在反应中加载详细信息页面
问题描述
现在我定义这样的路由路径:
const ArticleDetail = loadable(() =>
import(/* webpackChunkName: 'about' */ '@/views/App/Cruise/Article/ArticleDetail/ArticleDetail')
)
{
path: '/app/cruise/article/detail/:id',
exact: false,
name: 'Article Detail',
component: ArticleDetail
},
但是当我使用 url: 访问 articleDetail 时http://localhost:3000/#/app/cruise/article/detail/2923730
,我跟踪代码并发现跑步者没有进入artcleDetail
页面,我错过了什么吗?这是我的依赖项的一部分:
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-highlight-words": "0.17.0",
"react-loadable": "^5.5.0",
"react-redux": "^7.1.1",
"react-router-dom": "^5.1.1",
这是菜单渲染逻辑代码:
return (
<Layout className='app'>
<BackTop />
<AppAside menuToggle={menuToggle} menu={this.state.menu} />
<Layout style={{ marginLeft: menuToggle ? '80px' : '200px', minHeight: '100vh' }}>
<AppHeader
menuToggle={menuToggle}
menuClick={menuClick}
avatar={this.state.avatar}
show={this.state.show}
loginOut={this.loginOut}
/>
<Content className='content'>
<Switch>
{routes.map(item => {
return (
<Route
key={item.path}
path={item.path}
exact={item.exact}
render={props =>
!auth ? (
<item.component {...this.props} />
) : item.auth && item.auth.indexOf(auth) !== -1 ? (
<item.component {...this.props} />
) : (
` <Redirect to='/404' {...props} /> }> ) })} )
我应该怎么做才能解决这个问题?打开时http://localhost:3000/#/app/cruise/article/detail/2923730
,加载文章详细信息页面。
解决方案
推荐阅读
- react-native - react-i18next 函数 this.props.t('id', value)
- swiftui - 如何在 SwiftUI 中使用扩展将可访问性修饰符添加到文本视图
- sql - 从每组中的 3 个表中选择 sql 中具有最新日期的行
- react-native - React Native 中的应用程序模式
- flask - Flask 和 IIS8.5 windows 身份验证
- javascript - 将 instanceof 与从函数返回的类一起使用
- python - Python Beautifulsoup 两次返回值
- django - 为什么 django PermissionRequiredMixin 没有按预期工作
- angular - 如何解决mapbox gl js上的addSource错误
- node.js - NodeJs 流、管道和 https 帖子