Skip to content
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

如何动态加载主菜单 #172

Closed
bolord opened this issue Apr 9, 2017 · 6 comments
Closed

如何动态加载主菜单 #172

bolord opened this issue Apr 9, 2017 · 6 comments

Comments

@bolord
Copy link

bolord commented Apr 9, 2017

  1. router.js 为了支持 webpack chunk 实现按需加载需要定义全部的路由?
  2. 目前�数据写死在 utils/menu.js,如何根据后端的数据动态加载主菜单?且只在登录后加载一次?

在 menu.js 里使用同步请求加载数据肯定不是最佳方案,刚接触 dva 体系,希望大家可以提供点思路

@encorehe
Copy link

您好 请问一下 你的处理了吗? 我这边也有这个需求 菜单是通过接口获取的

@chimisu
Copy link

chimisu commented Apr 10, 2017

同求

@zuiidea
Copy link
Owner

zuiidea commented Apr 12, 2017

src/routes/app.js中用到了Sider组件,可以把menu数据传下去,你可以在src/models/app.js添加menu的state,subscriptions里去查询菜单

@chimisu
Copy link

chimisu commented Apr 15, 2017

@zuiidea 能说下怎么跟权限结合么?比如我的菜单信息是从后台传过来的,那我前台要怎么控制呢?如果这样的话,router.js是不是也要动态的?要怎么做?求个思路。

@jackple
Copy link
Contributor

jackple commented May 15, 2017

我现在是在modal/app的effects下已有的query下面加,暂时可以用

@zuiidea
Copy link
Owner

zuiidea commented Jul 5, 2017

#384

@zuiidea zuiidea closed this as completed Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants