一、get方法获取数据

axios.get('url')
.then(function (res) {
console.log(res);
}).catch(function (error) {
console.log(error);
});

二、post方法新增数据

axios.post('url', {

"name": "user2",
"age":20
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});

三、put方法修改数据

axios.put('url'+_id,{"name": "usernameupd"})

.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});

四、delete方法删除数据

axios.delete('url'+_id)
.then(function (res) {
console.log(res);
})
.catch(function (error) {
console.log(error);
});

 PS:

1、url 指对应访问的路径;

2、_id 指对应的数据 id,即_id = id;

3、{"name": "usernameupd"} 指要修改的数据,即将对应数据的name值更改为 usernameupd

axios之增删查改操作的更多相关文章

  1. 利用dbutils工具实现数据的增删查改操作(dbutis入门)

    一.前期准备 1.安装数据库(如:mysql5.5) 2.安装Eclipse(如:3.4) 3.下载数据库驱动包 4.下载dbutis工具包 5.在Eclipse创建名为 dbutils 的工程并在工 ...

  2. PHP与MYSQL结合操作——文章发布系统小项目(实现基本增删查改操作)

    php和mysql在一起几十年了,也是一对老夫老妻了,最近正在对他们的爱情故事进行探讨,并做了一个很简单的小东西——文章发布系统,目的是为了实现mysql对文章的基本增删查改操作 前台展示系统有:文章 ...

  3. Mybatis基础配置及增删查改操作

    一.简介 平时我们都用JDBC访问数据库,除了需要自己写SQL之外,还必须操作Connection, Statement, ResultSet 这些其实只是手段的辅助类. 不仅如此,访问不同的表,还会 ...

  4. Java连接MySQL数据库及简单的增删查改操作

    主要摘自 https://www.cnblogs.com/town123/p/8336244.html https://www.runoob.com/java/java-mysql-connect.h ...

  5. 在Eclipse上实现简单的JDBC增删查改操作

    在Javaweb的学习里,学到了如何完成简单的增删查改操作,在这里撰写一篇文章以便自己整理回忆. 首先要建立一些包和导入一些文件.建一些类.具体框架如图  编写Product类 public clas ...

  6. SSM框架-MyBatis框架数据库的增删查改操作

    话不多说,在User.xml文件中主要写一下操作数据库的sql语句,增,删,查,改是最常见的数据库操作 User.xml文件下:

  7. myBatis 实现用户表增删查改操作<方法1 没有使用接口的>(最终版)

    在UserMapper.xml中添加增删改查 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYP ...

  8. java操作ElasticSearch(es)进行增删查改操作

    有时间是要了解一下ES这个东西的~ ---------------------------------------------------------------------------------- ...

  9. myBatis 实现用户表增删查改操作<方法2 加入接口>(最终版)

    这2种方法的区别:1.添加接口 2.运用接口来实现 其他的都一样 添加接口 //接口的名字和xml的名字一样,这样xml中的namespace就不用改 public interface UserMap ...

随机推荐

  1. Hexo准备---Node.js、Vue

    Hexo准备---Node.js.Vue 安装node.js 1.下载node 配置node.js环境官网下载,一直next就好,非常方便. 下载官网: http://nodejs.cn/downlo ...

  2. mybatis(三)配置mapper.xml 的基本操作

    参考:https://www.cnblogs.com/wuzhenzhao/p/11101555.html XML 映射文件 本文参考mybatis中文官网进行学习总结:http://www.myba ...

  3. 007.NET5 Log4Net组件使用

    NET 5 Log4Net组件使用 1. Nuget引入程序集:log4net + Microsfot.Extensions.Logging.Log4Net.AspNetCore 2. 准备配置文件 ...

  4. Protocol Buffers All In One

    Protocol Buffers All In One Protocol Buffers - Google's data interchange format Protocol buffers are ...

  5. OTA development

    OTA development OTA update OTA Over the Air / 无线下载 https://en.wikipedia.org/wiki/Over-the-air_progra ...

  6. Typescript & readonly property

    Typescript & readonly property https://www.typescriptlang.org/docs/handbook/classes.html#readonl ...

  7. Flutter Hackathon 2020

    Flutter Hackathon 2020 https://flutterhackathon.com/#/ Flutter Day https://mp.weixin.qq.com/s/ux17-A ...

  8. js 实现各种数据结构 APP

    js 实现各种数据结构 APP 常见数据结构: 数组,队列,栈,堆,链表,集合,字典,散列表,树, 图 Array, Queue, Link, Collection, Set,Map, HashMap ...

  9. Flutter Widget API

    Flutter Widget API https://api.flutter.dev/ https://api.flutter.dev/flutter/material/material-librar ...

  10. DeFi 热潮下,NGK将成为下一个财富密码

    区块链正在脱虚向实,处于大规模落地,赋能实体产业的前夜,而在这个关键的关口,一个万亿市场的蓝海正在缓缓生成,成为区块链落地的急先锋,这个先锋便是DeFi. DeFi,即Decentralized Fi ...