赞
踩
不同于v3的component:()=>import ""
react中的路由懒加载需要引入lazy()函数.
下面就是示例啦:
- // import LoginView from "../views/login/LoginView";
- // import RegisterView from "../views/register/RegisterView";
- // import JiedanView from "../views/jiedan/JiedanView";
- import {lazy} from "react"
-
- const JiedanView = lazy(()=> import("../views/jiedan/JiedanView"))
- const RegisterView = lazy(()=> import("../views/register/RegisterView"))
- const LoginView = lazy(()=>import("../views/login/LoginView"))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。