我正在尝试在 PHP 中呈现 Redux + Webpack。我当前的工作流程如下所示。
- 使用 babel 将 ES6 编译成 js
- 使用 PHP V8 类来包含步骤 #1 中的脚本
- 渲染内容
- 将#1 中使用的 javascript 包含在脚本标签中。
一切正常,除了 #4 中包含的脚本重新呈现相同的视图,因为路由匹配。在路线中,我有以下配置。
<Provider store={store}>
<div style={{ height: '100%' }}>
<Router history={browserHistory} children={routes} />
</div>
</Provider>
有没有办法将参数传递给Router
组件以注册路由,但不执行它们?