由於 ant-design-pro 的 mock 是一個單獨的服務,所以沒有辦法整合到一起打包。暫時我是沒有找到。
所以解決方案就是不用 mock 。
由於 系統有異步調取,所以一旦有異步調取就會失敗,所以也不能有異步。
方案如下
1.刪除路由權限
2.刪除基本框架異步代碼
3.刪除基本框架權限代碼
4.添加hash功能
5.編譯build改為相對路徑
代碼如下
1 config/config.ts
// component: '../layouts/SecurityLayout', // authority: ['admin', 'user'], // authority: ['admin'],
2 src\layouts\BasicLayout.tsx
// useEffect(() => { // if (dispatch) { // dispatch({ // type: 'user/fetchCurrent', // }); // dispatch({ // type: 'settings/getSetting', // }); // } // }, []);
3 src\layouts\BasicLayout.tsx
{/* <Authorized authority={authorized!.authority} noMatch={noMatch}> */}
{children}
{/* </Authorized> */}
4 config/config.ts export default {
history: 'hash'
5 config/config.ts export default {
publicPath: './',
