react配置二级路由

1.在createBrowserRouter上添加basename属性,比如

const RouterRender = createBrowserRouter(
    [
        {
            path: '/',
            element: 
        },
        ...SystemRouter,
        ...InventoryRouter,
        ...FlowManageRouter,
        {
            path: "*",
            element: 
        }
    ],
    {
        basename:"/"
    }
)
export default RouterRender;

2.在package.json中添加"homepage":"."

{
     "homepage": "."
}

3。安心打包就可以啦

你可能感兴趣的:(react.js,javascript,前端)