vue中axios传参
安装npm install axios --save 安装main.js配置文件中使用methods: {findStudentGradeList () {this.$axios.post('/api/student/findStudentGradeList', this.studentGrade,{headers: {'content-Ty...
·
安装
npm install axios --save 安装
main.js配置
文件中使用
methods: {
findStudentGradeList () {
this.$axios.post('/api/student/findStudentGradeList', this.studentGrade,
{headers: {'content-Type': 'application/json;charset=utf-8'}})
.then(successResponse => {
console.log(successResponse)
this.tableData = successResponse.data
})
.catch(failResponse => {
alert('系统繁忙')
})
}
}
需要在config的index.js中配置
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
//我配置的地方
proxyTable: {
'/api': {
target: 'http://localhost:8082',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
更多推荐
已为社区贡献3条内容
所有评论(0)