el-table-column(prop="lastEnterAt" label="上一次进入的时间")
template(#default="scope")
span(v-if="scope.row.lastEnterAt") {{parseTime(scope.row.lastEnterAt, '{m}/{d} {h}:{i}:{s}')}}
在上面这个table column中,parseTime是我一个工具类的格式化时间的方法。
但如果scope.row.lastEnterAt值为空,没有时间戳传入的话则会报错。
这里使用了v-if就可以不触发parseTime方法,规避这个报错。但如果使用v-show则仍然报错