在项目根目录下创建vue.config.js文件,配置信息:
module.exports = { devServer: { proxy: { '/api': { target: 'http://192.168.0.8:9090', changeOrigin: true, ws: true, pathRewrite: { '^/api': '' } }, } } }
this.$axios.get('/api/users/search',{params:this.searUser}) .then(res => { this.loading = false; this.tableData = res.data.records; }).catch(err => { this.loading = false; this.$message.error(err); });