本文介绍了语义 UI Sidebar.Pushable 不会更新页面内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 redux 来管理我的侧边栏可见性状态(sidebarvis: true, false).路由也由 redux 管理.

I'm using redux to manage my sidebar visibility state(sidebarvis: true, false). Routing is also managed by redux.

当我单击链接以更改可见侧边栏中的页面时,redux 成功更新了路由器状态,但 sidebar.pushable 中的内容在侧边栏被切换之前不会更新(也就是在触发 toggleSideBar 操作之前).

When I click a link to change pages within my visible sidebar, redux is successfully updating the router state, but the content within sidebar.pushable does not update until my sidebar is toggled(AKA until the toggleSideBar action is dispatched).

换句话说,redux 工作正常,但页面不会呈现,直到侧边栏再次切换.有其他人遇到过这个问题吗?

In other words, redux is working properly, but the page doesn't render until the sidebar is toggled again. Has anyone else had this issue?

推荐答案

发现问题.Semantic-Ui 建议将侧边栏放在根级别,以便您的所有内容都包含在 Sidebar.Pusher 中.

Found the issue. Semantic-Ui suggests placing the sidebar at the root level so that all of your content is wrapped within Sidebar.Pusher.

如果您使用的是反应状态,这很好,但是如果您使用的是 redux,根(或我们在示例中常见的应用级别容器)容器似乎不喜欢连接到 redux 存储.

This is fine if you are using react state, but if you are using redux, the root (or App level container as we commonly see in examples) container doesn't seem to like being hooked up to the redux store.

我只是创建了一个侧边栏组件,在根容器中渲染它,并将我的所有路由作为子项传递到侧边栏.

I simply created a sidebar component, rendered that within the root container, and passed in all my routes as children to the sidebar.

这篇关于语义 UI Sidebar.Pushable 不会更新页面内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 22:44