博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vue+element-ui多选和按钮绑定并将值传往后端
阅读量:3909 次
发布时间:2019-05-23

本文共 1310 字,大约阅读时间需要 4 分钟。

遇到这样一个需求,就是选择若干条数据后对他们进行批量操作,并与后台关联

 

页面代码

上线

js代码 

onlineUser () {        this.$confirm('此操作将无法撤回, 是否继续?', '提示', {          confirmButtonText: '确定',          cancelButtonText: '取消',          type: 'warning'        }).then(() => {          let arr = this.multipleSelection          let multis = []          for (let i = 0; i < arr.length; i++) {            multis.push(arr[i].username)            console.log(multis)          }          axios({            method: 'POST',            url: Config.context + 'url',            data: {              users: multis // 此项为传往后端的数据            }          }).then(rs => {            if (multis.length !== null) {              this.$message.success('操作成功')            } else {              this.$message.error('操作失败')            }            console.log(rs)          })          this.$refs.multipleTable.clearSelection()            // 操作完成清除勾选框        }).catch(() => {          this.$message({            type: 'info',            message: '已取消操作'          })        })      },       // 选择框      speedupCheckbox: function () {        if (this.multipleSelection.length === 0) {          this.$message({            message: '请至少勾选一项,再进行操作',            type: 'warning'          })        } else {          this.onlineUser()        }      }

 

转载地址:http://vawrn.baihongyu.com/

你可能感兴趣的文章
groupcache源码分析
查看>>
go-metrics源码分析
查看>>
beego/cache源码分析---典型的工厂模式
查看>>
Boltdb源码分析(一)-------page结构
查看>>
Boltdb源码分析(二)----node结构
查看>>
Go标准库plugin源码分析----动态库使用
查看>>
开源代码学习-nsq(v0.1.1版本)源码分析
查看>>
开源代码学习-nsq(v0.1.5版本)源码分析
查看>>
开源代码protoactor-go[e866f39]源码分析
查看>>
开源代码protoactor-go源码分析-async schedule
查看>>
开源代码TarsGo-v1.0.0源码分析之transport
查看>>
本人公众号技术文章目录-持续更新
查看>>
MySQL存储过程详解 mysql 存储过程
查看>>
iOS跳转到app下载页面和app评论页面
查看>>
Java编写简单客户/服务器程序
查看>>
random_shuffle函数
查看>>
Pareto
查看>>
N个正数选取若干个数之和最接近M
查看>>
278 First Bad Version
查看>>
43 Multiply Strings
查看>>