-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
权限路由问题 #1063
Comments
参考umi文档约定式路由 |
那权限怎么配置,在哪个文件 |
参考mock/user.js里的userPermission |
@superlbr 权限路由也没有阻止history.listen中触发的接口,这个要怎么处理呢 |
无权限时页面组件并没有渲染,所以要解决这个问题,可以将订阅操作迁移到组件内,参加下面代码
...
- subscriptions: {
- setup({ dispatch, history }) {
- history.listen(location => {
- if (pathToRegexp('/user').exec(location.pathname)) {
- const payload = location.query || { page: 1, pageSize: 10 }
- dispatch({
- type: 'query',
- payload,
- })
- }
- })
- },
- },
...
...
class User extends PureComponent {
+ componentWillMount() {
+ const { location, dispatch } = this.props
+ const payload = location.query || { page: 1, pageSize: 10 }
+ dispatch({
+ type: 'user/query',
+ payload,
+ })
+ }
... |
因为项目中history.listen比较多,都移动到组件内工作量很大,想着有没有其他方式 |
没看懂+1 就是觉得很高级 |
这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。
|
权限路由是怎么弄的?没有找到对应的文件啊,你的路由在哪里配置的?所有文件都没有找到路由呢,按理来说路由不是配置在.umirc.js文件中的嘛?
The text was updated successfully, but these errors were encountered: