修改前的代码:
<el-table-column v-for="(item,index) in checkDatas" :key="index" v-if="checkLables.includes(item.label)" :label="item.label" :prop="item.props" >
</el-table-column>
使用v-for和v-if同时使用就会报错
修改后的代码:
<template v-for="(item,index) in checkDatas" :key="index">
<el-table-column v-if="checkLables.includes(item.label)" :label="item.label" :prop="item.props" >
</el-table-column>
</template>
使用template标签包裹,v-for 写在template 上,v-if 绑定在需要循环的元素之上即可