0%

使用Vue全家桶开发知乎日报

使用Vue2 + vue-router + vuex 开发的知乎日报

github地址,如果觉得还可以,不妨给个star吧

起因

因为经常看知乎日报,萌生了自己撸一个的想法,于是有了这个项目,不过github上面也有很多人做出来了

过程

直接使用vue-cli脚手架开撸

问题分析

图片防盗链

使用代理网站 Images.weserv.nl代理知乎图片

接口跨域问题

在本地启一个代理服务器(request ), 从而不会有跨域的问题

脚手架中已经集成了http-proxy-middleware作为代理,使用proxyTable即可代理接口,从而不会有跨域问题,用法见Proxy

代码结构(使用工具treer生成):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
src
├─App.vue
├─main.js
├─store
| └store.js
├─router
| └index.js
├─components
| ├─Carousel.vue
| ├─List.vue
| ├─NewsDetail.vue
| └NewsList.vue
├─common
| └util.js
├─assets
| ├─logo.png
| ├─top_logo.png
| ├─css
| | ├─reset.css
| | └zhihu_base.css
├─api
| └index.js

参考

知乎API分析

Welcome to my other publishing channels