传值:
<valid-two :content="2"></valid-two>
使用:
var validTwo = {
props: {
content : String
},
template: '<div>{{content}}</div>'
}
提示:
[Vue warn]: Invalid prop: type check failed for prop "content". Expected String with value "2", got Number with value 2.
限制Number类型
传值:
<valid-three content="Hello validation three"></valid-three>
使用:
var validThree = {
props: {
content : Number
},
template: '<div>{{content}}</div>'
}
提示:
[Vue warn]: Invalid prop: type check failed for prop "content". Expected Number with value NaN, got String with value "Hello validation three"