报错:Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘0’)
Problem code:
<el-table-column prop="number" label="总用例数 / 失败用例数" align="center" width="200">
<template #default="scope">
<span>{
{
scope.row.number[0]}}</span>
<span style="margin:0 3px">/</span>
<span class="failNumStyle" @click="toDetail(scope.row.id)">{
{
scope.row.number[1]}}</span>
</template>
</el-table-column>
reason:
Asynchronously display the initial data displayed first, and there is no data at this time
Correct code:
<el-table-column prop="number" label="总用例数 / 失败用例数" align="center" width="200">
<template #default="scope">
<span v-if="scope.row.number">{
{
scope.row.number[0]}}</span>
<span style="margin:0 3px">/</span>
<span class="failNumStyle" @click="toDetail(scope.row.id)" v-if="scope.row.number"
{
{
scope.row.number[1]}}
</span>
</template>
</el-table-column>