U 优化前端加载

pull/22/head
vapao 2020-01-18 10:12:00 +08:00
parent 6e742a8c36
commit c5fc903cce
4 changed files with 13 additions and 12 deletions

View File

@ -21,9 +21,9 @@ export default class extends React.Component {
<a title="文档" href="https://www.spug.dev/docs/about-spug/" target="_blank"
rel="noopener noreferrer">文档</a>
</div>
<text>
<div style={{color: 'rgba(0, 0, 0, .45)'}}>
Copyright <Icon type="copyright"/> 2019 By OpenSpug
</text>
</div>
</div>
</Layout.Footer>
)

View File

@ -3,7 +3,7 @@
* Copyright (c) <spug.dev@gmail.com>
* Released under the MIT License.
*/
import React from 'react';
import React, { Suspense } from 'react';
import { Switch, Route } from 'react-router-dom';
import moduleRoutes from '../routes';
import styles from './libs.module.css';
@ -53,10 +53,12 @@ export class Router extends React.Component {
render() {
return (
<Switch>
{this.routes.map(route => <Route exact strict key={route.path} {...route}/>)}
<Route component={NotFound}/>
</Switch>
<Suspense fallback={<div>Loading...</div>}>
<Switch>
{this.routes.map(route => <Route exact strict key={route.path} {...route}/>)}
<Route component={NotFound}/>
</Switch>
</Suspense>
)
}
}

View File

@ -3,10 +3,9 @@
* Copyright (c) <spug.dev@gmail.com>
* Released under the MIT License.
*/
import { makeRoute } from "../../libs/router";
import Index from './index';
import { lazy } from 'react';
import { makeRoute } from 'libs/router';
export default [
makeRoute('', Index),
makeRoute('', lazy(() => import('./index'))),
]

View File

@ -110,7 +110,7 @@ class LoginIndex extends React.Component {
<a title="文档" href="https://www.spug.dev/docs/about-spug/" target="_blank"
rel="noopener noreferrer">文档</a>
</div>
<text >Copyright <Icon type="copyright" /> 2019 By OpenSpug</text>
<div style={{color: 'rgba(0, 0, 0, .45)'}}>Copyright <Icon type="copyright" /> 2019 By OpenSpug</div>
</div>
</div>
)