[Vue warn]: Invalid prop: type check failed for prop "current". Expected Number with value NaN, got String with value "[object Object]1".
found in
---> <TestActions> at components/test-actions/test-actions.vue
<Root>
造成这个个错误的原因居然是:父组件的变量 current 与子组件的props名字相同,真是奇怪的错误,费了很长时间才解决,把变量名字改一下,就正常了
<test-actions :showSubmit="false" :current="current" :total="menus.length" @on-page="onPage" @open="handleOpenLeft"></test-actions>
props: {
current: {
type: Number,
default: 1
},
total: {
type: Number,
default: 1
},
showSubmit:{
type:Boolean,
default:true
}
},
父组件修改变量名后解决:
<test-actions :showSubmit="false" :current="currentF" :total="menus.length" @on-page="onPage" @open="handleOpenLeft"></test-actions>