Commit 9aa37cee authored by 何虹's avatar 何虹 💬

优化表格健壮性

parent 9c98fbfb
...@@ -101,12 +101,15 @@ ...@@ -101,12 +101,15 @@
:min-width="columnItem.width||80" :min-width="columnItem.width||80"
:sortable="columnItem.isSort?'custom':false" :sortable="columnItem.isSort?'custom':false"
> >
<template v-slot:header> <template v-slot:header>
<span v-if="columnItem.isRequired" :class="{'is-isRequired': columnItem.isRequired}"> <span
* v-if="columnItem.isRequired"
</span> :class="{'is-isRequired': columnItem.isRequired}"
<span>{{ columnItem.label }}</span> >
</template> *
</span>
<span>{{ columnItem.label }}</span>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<i <i
v-if="columnItem.type==='checkBox'" v-if="columnItem.type==='checkBox'"
...@@ -236,12 +239,15 @@ ...@@ -236,12 +239,15 @@
:min-width="column.width||80" :min-width="column.width||80"
:sortable="column.isSort" :sortable="column.isSort"
> >
<template v-slot:header> <template v-slot:header>
<span v-if="column.isRequired" :class="{'is-isRequired': column.isRequired}"> <span
* v-if="column.isRequired"
</span> :class="{'is-isRequired': column.isRequired}"
<span>{{ column.label }}</span> >
</template> *
</span>
<span>{{ column.label }}</span>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<i <i
v-if="column.type==='checkBox'" v-if="column.type==='checkBox'"
...@@ -396,7 +402,7 @@ export default { ...@@ -396,7 +402,7 @@ export default {
}, },
// 第一行数据 // 第一行数据
firstRow() { firstRow() {
return (this.data.length && this.data[0]) || {} return (this.data && this.data.length && this.data[0]) || {}
}, },
// 表格真实显示数据 // 表格真实显示数据
tableData() { tableData() {
...@@ -1083,7 +1089,7 @@ export default { ...@@ -1083,7 +1089,7 @@ export default {
td { td {
height: 35px !important; height: 35px !important;
} }
.is-isRequired{ .is-isRequired {
color: red; color: red;
} }
</style> </style>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment