后端返回这样的数据
[ { "addressId": 35, "city": "北京市", "createTime": null, "district": "西城区", "houseNumber": "a区1号12层230", "officeName": "北京大学第一医院-地下停车场", "province": "北京市", "recordStatus": 0, "userCode": "", "workAddress": "北京市西城区爱民一巷2号(北海北地铁站A西北口步行440米)", "workLatitude": 39.932312, "workLongitude": 116.380994 }, { "addressId": 36, "city": "北京市", "createTime": null, "district": "西城区", "houseNumber": "a区1号12层230", "officeName": "北京大学第一医院-地下停车场", "province": "北京市", "recordStatus": 0, "userCode": "", "workAddress": "北京市西城区爱民一巷2号(北海北地铁站A西北口步行440米)", "workLatitude": 39.932312, "workLongitude": 116.380994 } ]
使用elementui的el-table渲染数据时,prop只能显示一个属性,我想一次取city和district两个属性进行显示,此时可以采用插槽clot-scope获取到这行的数据,再将两个属性进行拼接
<el-table
:data="addressInfo"
style="width: 100%">
<el-table-column
prop="officeName"
label="地址">
</el-table-column>
<el-table-column
label="区域">
<template slot-scope="scope">
{{ scope.row.city+"·"+scope.row.district}}
</template>
</el-table-column>
</el-table>