const Login = Loadable({ loader: () => import('./components/Login'), loading: () => <div>loading...</div> })上面的很ok下面的模块导出方式不一样weather/index.jsimport view from './views/weather.js'export { view }const Weather = Loadable({ loader: () => { import { view as Weather } from './weather' 这里的Weather我怎么返回给loader,(不修改weather/index的前提下)由于是异步的,直接返回肯定不行}, loading: () => <div>loading...</div> })
2 回答
小怪兽爱吃肉
TA贡献1852条经验 获得超1个赞
用下面的方式可以
const Weather = Loadable({
loader: () => import('./weather').then(({ view }) => view),
loading: () => <div>loading...</div>
});
红颜莎娜
TA贡献1842条经验 获得超12个赞
const Weather = Loadable({
loader: () => import('./views/weather.js').view,
loading: () => <div>loading...</div>
})
添加回答
举报
0/150
提交
取消