vue.runtime.esm.js:4427 [Vue warn]: Invalid prop: type check failed for prop "model". Expected Object, got Number with value 0.
场景:
form表单点击编辑用户属性时报错。
分析:
一看就是非法传值,查看写的代码是否有哪些不妥地方,或者打印传入该函数得值,一步步排查。
handleEdit(row){
this.modelType = 1
this.dialogVisible = true
this.form = JSON.parse(JSON.stringify(row))
},
如果没什么错的话就看下传进来的地方:
<template slot-scope="scope">
<el-button size="mini" @click="handleEdit(scope.$index,scope.row)">编辑</el-button>
<el-button size="mini" @click="handleDel(scope.row)" type="danger">删除</el-button></el-button>
</template>
此处发现 handleEdit函数把scope.$index也传进来了,虽然没传错,但是接受的时候也没接收没用到,而且传的顺序也有问题,所以干脆没用到就不要传。此处把scope.$index删了就可以了。