获取歌手数据报错 Uncaught (in promise) Error: Timeout
来源:5-2 歌手数据接口抓取
qq_风吹一个小月亮_0
2019-10-21
写回答
2回答
-
看一下网络的 response 返回什么内容了
062019-10-22 -
布罗利00
2019-12-29
可以按照老师源码现在的写法 换成axios形式
# src/api/singer.js import axios from 'axios' import { commonParams } from './config' export function getSingerList() { const url = '/api/getSingerList' const params = Object.assign({}, commonParams, { channel: 'singer', page: 'list', key: 'all_all_all', pagesize: 100, pagenum: 1, hostUin: 0, needNewCode: 0, platform: 'yqq' }) return axios.get(url, { params }).then(res => res.data) }
node server
# vue.config.js before(app) { app.get('/api/getSingerList', function(req, res) { const url = 'https://c.y.qq.com/v8/fcg-bin/v8.fcg' axios.get(url, { headers: { referer: 'https://c.y.qq.com/', host: 'c.y.qq.com' }, params: req.query }).then(response => res.json(response.data)) .catch(e => console.log(e)) }) }
20
相似问题