天天看点

WordPress+React+dva 打造单页面博客

不需要修改WordPress就可以使用使用.

<a href="http://react.wordpress.femirror.com/">WordPress 后台演示</a>

账号 guest 密码 guest (会定时清理数据库和媒体库)

<a href="http://rw.femirror.com/">React 前台演示</a>

<a href="https://github.com/tyaqing/react-wordpress#%E7%89%B9%E6%80%A7">特性</a>

1 使用WordPress做内容管理,React重写前端.

2 使用dva构建React项目,dva内置React全家桶.

3 使用少部分antd组件,为后期更迭.

<a href="https://github.com/tyaqing/react-wordpress#%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E">使用说明</a>

首页的幻灯片是读取有特色图页面的数据

导航会依照有文章的分类自动生成

<a href="https://github.com/tyaqing/react-wordpress#%E8%B0%83%E8%AF%95">调试</a>

$ npm install

$ npm start

如果显示缺失dll.js 文件请执行

$ npm run build:dll

<a href="https://github.com/tyaqing/react-wordpress#%E6%9E%84%E5%BB%BA">构建</a>

$ npm run build

<a href="https://github.com/tyaqing/react-wordpress#%E9%83%A8%E7%BD%B2">部署</a>

<a href="https://github.com/tyaqing/react-wordpress#nginx">Nginx</a>

<a href="https://github.com/tyaqing/react-wordpress#%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98">跨域问题</a>

我是使用nginx做API代理,配置如下

location /api/ {

proxy_pass http://react.wordpress.femirror.com/;

}

<a href="https://github.com/tyaqing/react-wordpress#%E8%B7%AF%E7%94%B1%E9%97%AE%E9%A2%98">路由问题</a>

在正式环境下刷新可能会出现路由重定向问题,配置以下内容即可

location / {

try_files $uri /index.html;