我见过道具被定义为:
props: ['message', 'name', 'something']
和
props: { imperfectNumber: { type: Number, required: true } }
有什么区别?我如何定义一些不需要验证的道具和其他在同一块中完成所有操作的道具?
一旦你沿着对象定义的路线走下去,你必须用所有的道具来完成。你不能把它们混在一起。
您可以在此处找到有关道具的更多信息: http://vuejs.org/v2/guide/components.html#Prop-Validation
注:
相反 具有验证要求的对象
我强调了手册中解释的部分。这表明你可以做一个或另一个。