这里主要介绍的是 axios 的基础
GET
axios.get()
1 | axios.get('https://localhost:44322/api/user/get') |
methods 方法
1 | axios( |
POST
methods
1 | let data = { |
.net Core 跨域设置
在 Startup.cs 中,在 ConfigureServices 里面添加:
1 | // CORS 配置 |
然后在 Configure 里面添加:
1 | // CORS 配置 |
注意,这个要写在 app.UseMvc(); 上面。