element取表格对应id数据

<el-button size="mini" type="danger" @click="editor(scope.row)">编辑</el-button>
editor(row) {
this.dialogTableVisible = true;
this.id = row.id;
var item = this.tableData[this.id - 1];
this.form.name = item.name;
this.form.mobi = item.mobi;
this.form.account = item.account;
this.form.line = item.line;
}

第二种写法
<el-button size="mini" type="danger" @click="editor(scope.row)">编辑</el-button>
editor(row) {
this.dialogTableVisible = true;
this.id = row.id;
this.$axios({
url: api/index.php/admin/mod/' + this.id,
method: 'post'
}).then(res => {
// console.log(res.data.name);
var item = res.data;
this.form.name = item.name;
this.form.mobi = item.mobi;
this.form.account = item.account;
this.form.line = item.line;
}).catch(err => {
console.log(err)
})
}

posted on 2018-11-27 20:31  跳动的汗水  阅读(648)  评论(0编辑  收藏  举报

导航