在子级读取 images对象中的数据时会读取不到,因为展开行是在展开后才去读取你的数据,
而不是一开始就把数据准备好了,所以需要加个v-if="props.row.images" ,等数据加载好了才展示
,否则就会报错
<el-table :data="tableData" style="width: 100%" :stripe="true">
<el-table-column type="expand" style="width: 90%;margin:0 0 0 10%;">
<template #default="scope">
<el-image :src="scope.row.images" alt="" />
<el-table :data="scope.row.child" :show-header="false" style="margin:-17px 0 0 48px;width:calc(100% - 48px)" :stripe="true">
<el-table-column prop="" label="图片">
<template #default="props">
<el-image v-if="props.row.images" :src="props.row.images.file_path" alt="" style="width: 50px;"/>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column prop="" label="图片">
<template #default="scope">
<div class="pic">
<el-image :src="scope.row.images.file_path" alt="" style="width: 50px;"/>
</div>
</template>
</el-table>
Element ui 3.0 table expands row children and reports error when reading object data
Guess you like
Origin blog.csdn.net/xiaokangna/article/details/132986300
Ranking