Open aak1247 opened 1 year ago
node版本 16.13
提供可复现的 demo
import Layout from '@/layouts/index';
import Home from '@/pages/Home';
import About from '@/pages/About';
export default [
{
path: '/',
component: Layout,
children: [
{
path: '/',
exact: true,
component: Home
},
{
path: '/about',
component: About,
pageConfig: {
title: 'About'
}
},
]
}
];
使用的页面必须是一级 ( "/" ) 路由下的 children (即: 二级路由)
Describe the bug
使用页面级store,会报错: Uncaught TypeError: Cannot read properties of null (reading 'store') at Object.useSelector (useSelector.js:126) at useModelState (modelApis.js:28) at Object.useModel (modelApis.js:23) at TerminalManage (TerminalManage.tsx:11) // 这里是实际发生调用的位置 at renderWithHooks (react-dom.development.js:14985) at updateFunctionComponent (react-dom.development.js:17356) at mountLazyComponent (react-dom.development.js:17677) at beginWork (react-dom.development.js:19055) at HTMLUnknownElement.callCallback (react-dom.development.js:3945) at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
相同项目,使用应用级(全局)store可以正常使用。store文件的后缀名都是.ts,app和页面的后缀名都是tsx
版本信息: "ice.js": "^2.6.6",
Expected behavior
期望能够正常使用页面级store
Actual behavior
No response
Version of ice.js
2.6.6
Content of build.json or ice.config.mts
Additional context
No response