vue+element模態(tài)框中新增模態(tài)框和刪除功能
更新時間:2019年06月11日 10:49:29 作者:冬瓜先生
這篇文章主要介紹了vue+element模態(tài)框中新增模態(tài)框和刪除功能,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
實現效果如下

結構
<el-table-column sortable label="操作">
<template slot-scope="scope">
<el-button type="primary" @click="getMembers(scope.row.id)">成員</el-button>
<el-buttontype="primary" @click="delRole(scope.row.id, scope.$index)">刪除</el-button>
</template>
</el-table-column>
//scope.$index 獲取當前行的index
// 打開新增成員
openAddStaff() {
this.getAllStaff();
},
// 確定新增
addStaff() {
if (!this.user) {
this.$message.error("請選擇用戶!");
return;
}
this.$post(
"/api/RoleMemberController/add",
{ userId: this.user.split("/")[0], roleId: this.roleId },
data => {
console.log(data,111)
this.$message.success("添加成功!");
this.dialogAddStaffVisible = false;
let item = {
id: data.rm.id,
userId: data.rm.userId,
userCname: this.user.split("/")[1]
};
this.staffList.push(item);//從數組中添加當前行
}
);
},
// 刪除員工
delStaff(id, index) {
this._confirm("確定刪除嗎?", () => {
this.$post("/api/RoleMemberController/delOne", { id: id }, data => {
this.$message.success("刪除成功!");
this.staffList.splice(index, 1);//從數組中刪除當前行
});
});
},
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
VUE實現分布式醫(yī)療掛號系統(tǒng)預約掛號首頁步驟詳情
這篇文章主要為大家介紹了VUE實現分布式醫(yī)療掛號系統(tǒng)預約掛號首頁步驟詳情,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-04-04
解決webpack+Vue引入iView找不到字體文件的問題
今天小編就為大家分享一篇解決webpack+Vue引入iView找不到字體文件的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-09-09
Vue.js實現一個自定義分頁組件vue-paginaiton
這篇文章主要為大家詳細介紹了Vue.js實現一個自定義分頁組件vue-paginaiton的具體代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-09-09

