Invalid prop: type check failed for prop “xxx“报错处理
首先我们看到这个报错,这个报错的意思是说:无效的命名数据:“数据”类型检查失败。而且上面说了是Boolean类型错误,要把值改成"true",并且看到是tag标签的错误,于是检查代码:<el-table-column prop="process_id" label="模板号" align="center" min-width="50"><template v-slot="{ ro
·

首先我们看到这个报错,这个报错的意思是说:无效的命名数据:“数据”类型检查失败。而且上面说了是Boolean类型错误,要把值改成"true",并且看到是tag标签的错误,于是检查代码:
<el-table-column prop="process_id" label="模板号" align="center" min-width="50">
<template v-slot="{ row }">
<div slot="content">
<el-tag v-if="row.process_id == 0" disable-transitions="true" type="warning">{{ `未定义模板` }}</el-tag>
<el-tag v-else-if="row.process_id == 1" disable-transitions="true">{{ `基础模板` }}</el-tag>
<el-tag v-else-if="row.process_id == 2" disable-transitions="true" type="success">{{ `自定义模板` }}</el-tag>
</div>
</template>
</el-table-column>
这里发现使用的值是"true",但是他执行时是按照String类型执行,而不是Boolean去执行的
查看文档
很经典的问题处理办法:加冒号
<el-table-column prop="process_id" label="模板号" align="center" min-width="50">
<template v-slot="{ row }">
<div slot="content">
<el-tag v-if="row.process_id == 0" :disable-transitions="true" type="warning">{{ `未定义模板` }}</el-tag>
<el-tag v-else-if="row.process_id == 1" :disable-transitions="true">{{ `基础模板` }}</el-tag>
<el-tag v-else-if="row.process_id == 2" :disable-transitions="true" type="success">{{ `自定义模板` }}</el-tag>
</div>
</template>
</el-table-column>
更多推荐



所有评论(0)