关于脚手架创建代理服务器失败

问题遇到的现象和发生背景

打开写的服务器(http://localhost:5000/students)正常

img


也在vue.config.js里面添加了devServer
为什么请求服务后还是会出错

问题相关代码,请勿粘贴截图

vue.config.js

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,//关闭语法检查
  devServer: {
    proxy: 'http://localhost:5000'
  }
})


App.vue

<template>
    <div>
        <button @click="getStudents">获取学生信息</button>
    </div>
</template>

<script>
    import axios from 'axios'
    export default {
        name:'App',
        methods: {
            getStudents(){
                axios.get('http://localhost:8080/students').then(
                    response => {
                        console.log('请求成功了',response.data)
                    },
                    error => {
                        console.log('请求失败了',error.message)
                    }
                )
            },
        },
    }
</script>


运行结果及报错内容

还是显示跨域的问题

我想要达到的结果

点击按钮后正常获取get请的内容

将 app.vue中的localhost改为自己打开浏览器的地址栏显示的地址