Closed aldabil21 closed 2 years ago
没懂你的具体问题是什么,按照文档示例跑不通?
你这就是把 state,reducer合并到了store,跟单独export state, reducer 有什么区别?
总是 undefined 是因为你没导出呀,这里读的就是开发者的 state,reducer
已经导出的就像文档解释的这里
请 console
state, reducer
const { reducer, state } = Routes
再console
store value
const { store } = Routes
哦我知道问题了,这里是上次修 vue 的bug的时候把react这种情况忽略了
详细描述你的问题
根据文档扩展自定义 Reducer, 以及import store statement这里,框架应该混合自己的default reducer, 和用户自己写的的state/reducer.
只不过在这个情况下,用户不能利用自己创建的store, 因为state, reducer这里总是undefined。实际上是
store?.state
与store?.reducer
期望的结果
import statement应该包括用户创建的state, reducer
当前使用的版本
6.2.x
复现仓库地址
参考仓库. 我已修改
ReactRoutesType
和 import statements. 如果觉得这个解决方案是可以的,我以下连 PR。你本人对问题可能的原因判断(如果你能大概判断的话)
或许
ssr-declare-route
由export * as store from "@/store/index"
的statement (?)