Vue前后端通信
跳到导航
跳到搜索
环境搭建
项目搭建
前后端通信
安装VScode用于前端开发
参考地址:https://blog.csdn.net/qq_42367703/article/details/88074154
用VScode 打开项目文件夹
安装axios
npm install axios --save
在src文件夹下新增src/view/demo.vue
在demo编写前端代码
修改app.vue指向demo文件
启动后端项目
待编写
启动前端项目
启动后访问地址
点击掉后台按钮
如果报错
'response' is defined but never used
这个问题,是由于 vue 项目安装了 ESLint 。
暴力解决:直接关闭 ESLint
在 package.json 文件中 添加
"rules": {
"generator-star-spacing": "off",
"no-tabs":"off",
"no-unused-vars":"off",
"no-console":"off",
"no-irregular-whitespace":"off",
"no-debugger": "off"
}