// 相关链接 https://www.npmjs.com/package/react-loadable
// utils loader.jsx
import React from 'react'
import Loadable from 'react-loadable';
const Loading = () => <div> 加载中... </div> // 加载中...
export default (loader, loading = Loading) => {
return Loadable({
loader: loader,
loading,
});
}
/*
const LoadableComponent = Loadable({
loader: () => import('./my-component'),
loading: Loading,
});
*/
// route.js
import loader from '@/utils/loader' // 懒加载
const App = loader(() => import('@/pages/app'))
React 路由懒加载
最新推荐文章于 2023-12-04 11:57:29 发布