element取表格对应id数据

第一种写法

编辑
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;													
			}

第二种写法

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

你可能感兴趣的:(vue,element)