如图点击表格中的编辑后,会出现弹框。请问怎么让弹框的input框里显示出当前el-table-column的内容呢?这些表格里值应该怎么读取到input框里?
代码如下:
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
fixed
align="center"
type="index"
prop="squ"
label="序号"
width="50">
</el-table-column>
<el-table-column
prop="name"
label="用户名"
width="80">
</el-table-column>
<el-table-column
prop="date"
label="发布时间"
width="150">
</el-table-column>
<el-table-column
prop="content"
label="内容"
width="250">
</el-table-column>
<el-table-column
prop=""
label="操作"
width="180"
align="center">
<template slot-scope="scope">
<!--修改按钮-->
<el-button
size="mini"
@click="dialogFormVisible1 = true">编辑</el-button>
<!--修改信息的弹窗 -->
<el-dialog title="信息" :visible.sync="dialogFormVisible1" width="350px">
<el-form :model="changeForm" label-width="80px">
<el-form-item label="序号:" >
<el-input v-model="changeForm.squ" auto-complete="off" ></el-input>
</el-form-item>
<el-form-item label="姓名:" >
<el-input v-model="changeForm.name" auto-complete="off" ></el-input>
</el-form-item>
<el-form-item label="内容:">
<el-input v-model="changeForm.content" auto-complete="off"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false">取 消</el-button>
<el-button type="primary" @click="dialogFormVisible1 = false,changeImgInfo()">确 定</el-button>
</div>
</el-dialog>
<el-button size="mini" @click="dialogFormVisible1 = true">编辑</el-button>
点击事件改成方法,把这行的值传到方法里进行赋值 ,在方法里面执行dialogFormVisible1 = true打开弹窗显示赋值
您好!谢谢您的回答。我按照您的回复改了,但是赋值这里我不太会处理,请您帮我再指点一下。
代码如下:
<!--修改按钮-->
<el-button
size="mini"
@click="Edit()">编辑</el-button>
方法: Edit(){
this.changeForm.name=this.commentData.name;
this.dialogFormVisible1 = true;
}
@echomay: @click="Edit(scope.row)"
Edit(row){
this.changeForm.name=row.name;
this.dialogFormVisible1 = true;
}
@___mouM: 啊!谢谢您啊,太感谢了!