固定的行:行名称不一样,每一个值对应赋值
html:
<el-table class="table-box" :data="allObj.peoArr"><el-table-column prop="name" min-width="130"></el-table-column><el-table-column label="车主" prop="owner" min-width="180" v-if="typeFlag == 1 || typeFlag == 2 "><template slot-scope="scope"><span>{{ (scope.row.owner || '') }}</span></template></el-table-column><el-table-column prop="insuredName" label="被保险人" min-width="180"><template slot-scope="scope"><span>{{ (scope.row.insuredName || '') }}</span></template></el-table-column><el-table-column prop="benefiPeo" label="受益人" min-width="180" v-if="typeFlag ==3"><template slot-scope="scope"><span>{{ (scope.row.benefiPeo || '') }}</span></template></el-table-column><el-table-column label="投保人" min-width="180"><template slot-scope="scope"><span>{{ (scope.row.applicantName || '') }}</span></template></el-table-column></el-table>
data:
peoArr: [{ name: '姓名', owner: '', insuredName: '', benefiPeo: '', applicantName: '' },{ name: '手机号', owner: '', insuredName: '', benefiPeo: '', applicantName: '' },{ name: '证件类型', owner: '', insuredName: '', benefiPeo: '', applicantName: '' },{ name: '证件号', owner: '', insuredName: '', benefiPeo: '', applicantName: '' },{ name: '邮箱', owner: '', insuredName: '', benefiPeo: '', applicantName: '' },{ name: '城市', owner: '', insuredName: '', benefiPeo: '', applicantName: '' },{ name: '地址', owner: '', insuredName: '', benefiPeo: '', applicantName: '' }],
方法内 对应赋值
this.allObj.peoArr = [{ name: '姓名', owner: '1', insuredName: '11', benefiPeo: '王企鹅无群', applicantName: '' },{ name: '手机号', owner: '2', insuredName: '22', benefiPeo: '王企鹅', applicantName: '' },{ name: '证件类型', owner: '3', insuredName: '222', benefiPeo: '', applicantName: '特务' },{ name: '证件号', owner: '4', insuredName: '444', benefiPeo: '惹我', applicantName: '' },{ name: '邮箱', owner: '5', insuredName: '555', benefiPeo: '', applicantName: '二' },{ name: '城市', owner: '6', insuredName: '666', benefiPeo: '', applicantName: '' },{ name: '地址', owner: '7', insuredName: '777', benefiPeo: '', applicantName: '' }]