reactjs - 两个巢反应路线如何正确?
问题描述
import { Route, BrowserRouter as Router, Switch } from 'react-router-dom'
<Router weId={`${this.props.weId || ''}_wfcgvw`} basename={`${parentPath}/e10`}>
<Route weId={`${this.props.weId || ''}_1jvdgd`} exact path={`/index`} component={ME10Index} />
<Route weId={`${this.props.weId || ''}_1jvdgd`} path={`/invoice`} component={ME10Invoice} />
<Route weId={`${this.props.weId || ''}_1jvdgd`} path={`/statistic`} component={ME10Statistic} />
<Route weId={`${this.props.weId || ''}_cg92wc`} exact path={'/mine'}component={ME10Mine} />
<Route weId={`${this.props.weId || ''}_cg92wc`} exact path={'/mine/mail'} component={ME10MailSetting} />
</Router>
如您所见,我有一个像这样的路由器,我想优化这部分:
从
<Route weId={`${this.props.weId || ''}_cg92wc`} exact path={'/mine'}component={ME10Mine} />
<Route weId={`${this.props.weId || ''}_cg92wc`} exact path={'/mine/mail'} component={ME10MailSetting} />
至
<Route weId={`${this.props.weId || ''}_ucqhv6`} path="/mine">
<Route weId={`${this.props.weId || ''}_cg92wc`} path={''}component={ME10Mine} />
<Route weId={`${this.props.weId || ''}_cg92wc`} path={'mail'} component={ME10MailSetting} />
</Route>
很快,我想使路线简短并包含嵌套信息。怎么做?谢谢。
解决方案
推荐阅读
- python - Python中的网络爬虫
- jenkins - 在后期检查每个阶段的结果 - Jenkins Pipeline
- php - xss_clean 删除 tinymce 的格式
- php - 如何检查 shell 命令是否从 PHP 运行
- powerbi - PowerBI - DateAdd 最大值
- sql - 使用 CSV 列和来自其他列的电子邮件的 SQL 查询
- paypal - 如何重定向到 PayPal-Sandbox 上其他版本的结帐页面
- python - Sphinx - 如何更改函数参数的格式样式
- rust - 您如何将参数用于在错误处理代码中出错的函数?
- linux - 如何通过 ssh 连接覆盖本地 bash 脚本变量?