热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用vueresource发送RESTful接口调用

vue里面使用vue-resource和后台RESTful后台接口我能找到的现有资料是:1.delete==this.$resource(url).delete([opt

vue里面使用vue-resource和后台RESTful后台接口

我能找到的现有资料是:
1.delete==>this.$resource(url).delete([options]).then()
2.使用remove或delete方法发送DELETE请求,下面这个请求指定了{/id}。

1
2
3
4
5
6
7
deleteCustomer: function(customer){

var resource = this.$resource(this.apiUrl)

    vm = this

resource.remove({ id: customer.customerId})

    .then((response) => {

        vm.getCustomers()

    })}

现在我想实现批量删除,我拿到了一个数组,数组里面是需要删除的表格行的id。
ids=[111,222]
后台只需要这样的数组就行

现在利用这个,发送参数
this.$resource(url).delete([options]);
问题1:ids 我要怎么发送给后台?
问题2:是要在option里面自己写body属性吗?


推荐阅读
author-avatar
原野上的蚂蚁
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有