<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)
})
}