import React, { Suspense } from 'react'
import { Route } from 'react-router-dom'

// 路由组建配置
export default route => {
    const attrs = {
        path: route.path,
        exact: route.exact,
        render: props => {
            if (route.name) document.title = route.name
            return <route.component {...props} routes={route.routes} />
        }
    }
    return (
        <Suspense fallback={<div />}>
            <Route {...attrs} />
        </Suspense>
    )
}
