2
次のように実装されたときPlainRoute
ルータロジックは完璧に動作...WebPACKのコード分割、別のファイルからインポートした場合System.importルートが見つからない
const componentRoutes = {
component : Home,
path : '/',
indexRoute : Index,
childRoutes : [
{
path: 'child',
getComponent(location, cb) {
System.import('./Child/components/child')
.then(module => cb(null, module.default))
}
}
]
}
しかし、私は区切りファイルに宣言しようとすると、
子供/ index.js
export default() => ({
path: 'child',
getComponent(location, cb) {
System.import('./components/child')
.then(module => cb(null, module.default))
}
})
そして、実行します。
import Child from './Child'
const componentRoutes = {
component : Home,
path : '/',
indexRoute : Index,
childRoutes : [
Child
]
}
それはもはや子route
を見つけていません。
ルータの履歴としてHashHistoryが使用されています。あなたのChild/index.js
あなたが関数をエクスポートが、その後、あなたはchildRoutes
にその関数に渡すには
は完璧な作品、ありがとうございます! :) – volna