请求的路径为http://106.14.175.81/oauth/token
vue.config.js配置
module.exports = {
// local Laravel server address for api proxy
devServer: {
proxy: {
'/api': {
target: 'http://106.14.175.81',
changeOrigin: true,
}
}
},
// outputDir should be Laravel public dir
outputDir: '../../../public/',
publicPath: '/',
// for production we use blade template file
indexPath: process.env.NODE_ENV === 'production'
? '../resources/views/icustomer.blade.php'
: 'index.html',
}
代码是放于php框架里,下面那一部分为配合框架的配置
request.js配置
import axios from 'axios'
const request = axios.create({
baseURL: '', // 基础路径
withCredentials: true // 表示请求可以携带cookie
})
export default request
请求配置
import request from '../util/request'
export const getToken = data => {
return request({
method: 'post',
url: 'oauth/token',
data: data
})
}
使用
const arr = {
grant_type: 'password',
client_id: '1',
client_secret: '7VTqL26ZqDLsCuT1PtSiwuol5BrYB5yZ3GCRHwQW',
username: this.form.username,
password: this.form.password,
scope: ''
}
const data = await getToken(arr)
报错
![image.png image.png](https://cdn.ostack.cn/v-5feb05cf/global/img/squares.svg)
文件路径
![image.png image.png](https://cdn.ostack.cn/v-5feb05cf/global/img/squares.svg)
哪位大神能帮我解答下
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…