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

关于动态渲染侧边栏的疑惑 #3508

Closed
HeroMeiKong opened this issue Nov 16, 2020 · 4 comments
Closed

关于动态渲染侧边栏的疑惑 #3508

HeroMeiKong opened this issue Nov 16, 2020 · 4 comments

Comments

@HeroMeiKong
Copy link

Question(提问)

想通过服务器返回的文章数量来显示文章,相当于动态显示文章列表里面的内容,如下图:
WechatIMG8517
不知道有没有快捷的办法?
我想的是先去请求服务器,然后得到数据,再去构建 router,但是感觉这样不太好,各位大佬有什么方法吗?

@toesbieya
Copy link

菜单和路由分离,文章页面使用:id的方式去访问

但是如果没有文章时不就有问题?

@HeroMeiKong
Copy link
Author

HeroMeiKong commented Nov 16, 2020

@toesbieya 这个的话,想的是做个添加个"暂无文章“的页面,或者不添加页面,写成这种

,返回个默认值
。这边路由是打算采用:id的形式,主要是具体是怎么将文章加入到目录下的呢?

@toesbieya
Copy link

@HeroMeiKong 侧边栏的数据存在@/store/module/permission.js #route中,直接改就行

@HeroMeiKong
Copy link
Author

@toesbieya 好的,我直接在套了个请求在 generateRoutes 里面,效果是达到了

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

2 participants