Skip to content

Commit

Permalink
Merge pull request #2 from Reaper622/dev
Browse files Browse the repository at this point in the history
图标添加与动态加载
  • Loading branch information
Reaper622 authored Sep 27, 2019
2 parents 81991e8 + 55915ff commit f2195aa
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 23 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"react-hot-loader/babel",
"styled-components",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-syntax-dynamic-import"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A system to build your own blog site.

修改一个配置文件,即可搭建出你自己的博客平台。

线上演示地址: [reaperlee.cn](www.reaperlee.cn)
线上演示地址: [reaperlee.cn](http://www.reaperlee.cn)



Expand Down
12 changes: 0 additions & 12 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@
"avatar": "https://avatars2.githubusercontent.com/u/33087372?s=460&v=4",
"intro": "The world's best FE developer",
"path": "https://github.com/LumiereXyloto"
},
{
"name": "Lumiere Xyloto2",
"avatar": "https://avatars2.githubusercontent.com/u/33087372?s=460&v=4",
"intro": "The world's best FE developer",
"path": "https://github.com/LumiereXyloto"
},
{
"name": "Lumiere Xyloto3",
"avatar": "https://avatars2.githubusercontent.com/u/33087372?s=460&v=4",
"intro": "The world's best FE developer",
"path": "https://github.com/LumiereXyloto"
}
],
"server_url": "http://127.0.0.1:4000"
Expand Down
3 changes: 2 additions & 1 deletion config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ const commonConfig = {
threadPool: happyThreadPool
}),
new HtmlWebpackPlugin({
template: 'public/index.html'
template: 'public/index.html',
favicon: 'public/favicon.ico'
}),
// 拷贝的静态资源不做打包处理
new CopyWebpackPlugin([{
Expand Down
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"homepage": "https://gitlab.com/Reaper622/react-cli-singlepage#README",
"dependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/polyfill": "^7.4.4",
"animate.css": "^3.7.2",
"antd": "^3.23.2",
Expand All @@ -39,6 +40,7 @@
"ramda": "^0.26.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-loadable": "^5.5.0",
"react-redux": "^7.1.1",
"react-router-dom": "^5.0.1",
"react-transition-group": "^4.3.0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/PageLoading.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { Spin } from 'antd'

export default () => (
Expand All @@ -10,7 +11,7 @@ export default () => (
top: 0;
right: 0;
bottom: 0;
background: rgba(255,255,255,0.3);
background: rgba(255,255,255,0.2);
z-index: 10001;
display: flex;
align-items: center;
Expand Down
34 changes: 28 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import {BrowserRouter, HashRouter, Route, Switch} from 'react-router-dom'
import {createStore, applyMiddleware, compose} from 'redux'
import Loadable from 'react-loadable'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux'
import { reducer } from './redux/store'
Expand All @@ -14,10 +15,31 @@ import 'animate.css/animate.min.css'
import PageLoading from '@components/PageLoading'

// 页面
import Index from './Pages/Index'
// import Index from './Pages/Index'
import Article from './Pages/Articles'
import Archives from './Pages/Archives'
import Friend from './Pages/Friend'
// import Archives from './Pages/Archives'
// import Friend from './Pages/Friend'
// 动态路由加载,提升用户感受
const AsyncIndex = Loadable({
loading: PageLoading ,
timeout: 1000,
loader: () => import('./Pages/Index')
})
// const AsyncArticle = Loadable({
// loading: PageLoading ,
// timeout: 1000,
// loader: () => import('./Pages/Articles')
// })
const AsyncArchives = Loadable({
loading: PageLoading ,
timeout: 1000,
loader: () => import('./Pages/Archives')
})
const AsyncFriend = Loadable({
loading: PageLoading ,
timeout: 1000,
loader: () => import('./Pages/Friend')
})

const store = createStore(reducer, compose(
applyMiddleware(thunk),
Expand All @@ -32,10 +54,10 @@ class App extends Component {
<BrowserRouter>
{/* <HashRouter> */}
<Switch>
<Route path='/' exact component={Index} />
<Route path='/' exact component={AsyncIndex} />
<Route path='/articles/:id' component={Article} />
<Route path='/archives' component={Archives} />
<Route path='/friend' component={Friend} />
<Route path='/archives' component={AsyncArchives} />
<Route path='/friend' component={AsyncFriend} />
</Switch>
{/* </HashRouter> */}
</BrowserRouter>
Expand Down

0 comments on commit f2195aa

Please sign in to comment.