网站推广seo设置应用asp做网站
1. el-table 空白列赋值
对el-table中未传数据存在空白的列赋默认值0。使用el-table 提供的插槽 slot-scope:{{ row || ‘0’ }}
 原数据:
 
<el-table-column label="集镇"  :prop=city ><template slot-scope="{row}">{{ row || '0' }}</template>
</el-table-column> 
2.el-table 对循环产生的空白列赋值
对于循环产生的列,仍要赋默认值0,可采用以下方式: {{ row[col.city] || ‘0’ }}
 原数据:
 
<template v-for="col in cols"><el-table-column :label=col.label><el-table-column label="集镇" :prop=col.city ><template slot-scope="{row}">{{ row[col.city] || '0' }}</template></el-table-column><el-table-column label="农村" :prop=col.village><template slot-scope="{row}">{{ row[col.village] || '0' }}</template></el-table-column>       </el-table-column>
</template> 
问题解决:
 
