undefinedfix
Sign in

Type verification of props in Vue

CyclicUniverse edited in Fri, 23 Sep 2022

clipboard.png

Step one

如果值不是对象在则**type:Object**验证器抛出异常,

Step 2

如果content不存在则默认值是一个**对象**。

analysis

 如果值不是对象始终无法成立**步骤一**,如果成立步骤一(值是对象) 则 不可能给默认值,

To sum up

 永远不会有default返回。

So this kind of writing is ambiguous, right?

1 Replies
zkuir
commented on Fri, 23 Sep 2022

See more documents: prop verification

There is a sentence in the code given here: null and undefined will pass any type validation.