以 猫眼电影为例
https://i.maoyan.com/
vue.config.js
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
proxy: {
'/api': {
target: 'https://i.maoyan.com/', //请求对象
ws: true,//代理websocked
changeOrigin: true,
secure: false, //target是否为https接口
pathRewrite: {
'/api': '' //更改请求URL
}
}
}
}
})
.vuezhong
axios.get('/api/api/mmdb/movie/v3/list/hot.json?ct=%E5%93%88%E5%B0%94%E6%BB%A8&ci=105&channelId=4').then(res =>{
console.log(res)
获取到的数据