Giter Site home page Giter Site logo

douban's Introduction

模仿豆瓣前端

Build Status

vue.js 2.0, vuex, vue-router, vue-server-renderer, express, cheerio, superagent, redis

live demo (部署在搬瓦工主机上,海外节点,应该需要1s)

http://book.jk77.me

1. Build

# 启动 redis

redis-server &

# 安装依赖
npm install

# 启动在开发环境
npm run dev

# 初始化数据 / 爬虫启动
curl http://host:port/api/spider // 更替换成真实地址和端口号

# 启动在生产环境
npm run build && npm start

2. 注意

  1. 请确认 redisstart 状态

  2. 在浏览器中访问 http://127.0.0.1:4000/api/spider 启动爬虫

  3. 目前完成的界面: 首页, 读书首页, 标签页, 列表页, 详情页

    http://127.0.0.1:4000/

    http://127.0.0.1:4000/book

    http://127.0.0.1:4000/tags

    http://127.0.0.1:4000/tag:name

    http://127.0.0.1:4000/subject:id

  4. 增加了搜索功能,优化了排版, 但是豆瓣没有评论接口,所以只能等日后写爬虫解决

3. Vue.js1.0 更新到 Vue.js2.0 记录

  1. 在2.0中 Vue.set(store.item, item) 不会触发更新dom, store.item = item 才可以
  2. 由于 server side render 的原因, 不能使用 vue-resource 了, 改用 superagent 发请求了
  3. store.item 为{}时, 在页面中引用 会直接error, 需要指定详细数据类型
  4. v-html 替换了 {{{}}}
  5. webpack出现了 mdzz 的错误 Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. 解决办法为:
$ npm uninstall webpack --save-dev

followed by

$ npm install [email protected] --save-dev

Then you should be able to gulp again. Fixed the issue for me.

然后 npm run dev 即可, 蜜汁玄学 参考: angular/angular-cli#2234

<div>
  <span v-for="n in 10">{{ n }}</span> // 需要指定n
</div>
<div>
  <span v-for="(item, $index) in items">{{ $index }}</span> // 需要显示声明$index
</div>
```

上面的 bug 已经被 尤大 fixed

### 4. 更新记录
2016 11 19 根据 i5ting 前辈的建议, 更改了目录结构
2016 12 01 fix babel error

### 5. 目录结构
<pre>
.
├── README.md 
├── build
├── index.html
├── server.js
├── frontend
│   ├── App.vue
│   ├── app.js
│   ├── assets
│   ├── client-entry.js
│   ├── components
│   ├── router
│   ├── server-entry.js
│   ├── store
│   └── views
├── backend
│   ├── spiders
│   └── routers
├── node_modules
├── package.json
├── public
└── test

douban's People

Contributors

playmyswift avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.