Skip to content

Commit

Permalink
[feature]{music,zhihu}: 修改一次代理api
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Jul 24, 2019
1 parent c9c3b36 commit bf83ac3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/views/DouBan/music.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default {
};
axios({
method: 'post',
url: `${this.url}/detail`,
url: `${this.url}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/DouBan/zhihu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default {
})
},
GetReport() {
axios.get('/report/hot').then((response) => {
axios.get('/report').then((response) => {
console.log(response)
this.report = response.data.recent
})
Expand Down
5 changes: 2 additions & 3 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,14 @@ module.exports = {
},
},
'/report': {
target: 'https://news-at.zhihu.com/api/4/news', // 设置你调用的接口域名和端口号 别忘了加http
target: 'https://news-at.zhihu.com/api/4/news/hot', // 设置你调用的接口域名和端口号 别忘了加http
changeOrigin: true,
pathRewrite: {
'^/report': '', // 这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
},
},

'/music': {
target: 'https://music.163.com/weapi/v3/playlist', // 设置你调用的接口域名和端口号 别忘了加http
target: 'https://music.163.com/weapi/v3/playlist/detail', // 设置你调用的接口域名和端口号 别忘了加http
changeOrigin: true,
pathRewrite: {
'^/music': '', // 这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
Expand Down

0 comments on commit bf83ac3

Please sign in to comment.