基于vue2.x全家桶实现的知乎日报
版权声明:
技术栈
难点:
1.知乎api的调用,这里参考了cccyb的知乎日报中开发环境调用接口的方法
proxyTable: {
'/api':{
target:'http://news-at.zhihu.com',
changeOrigin:true,
pathRewrite:{
'^/api':'/api/4'
}
},
'/api7':{
target:'http://news-at.zhihu.com',
changeOrigin:true,
pathRewrite:{
'^/api7':'/api/7'
}
}
attachImgUrl(url){
if(url!=undefined){
//将图片链接替换,直接访问知乎图片会返回403,这是对应知乎防盗链的操作
return url.replace(/http\w{0,1}:\/\/p/g, 'https://images.weserv.nl/?url=p');
}
},
说明:
项目结构:
By KoimeijiLogi
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
For a detailed explanation on how things work, check out the guide and docs for vue-loader.