the first time I came into contact with vue, I learned the following example of props verification. Why do I verify a number and give it a string without reporting an error?
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
</head>
<body>
<div id="app1">
{{message}}
<!-- v-on @-->
<!-- v-bind: :-->
<first-com mss1="hello world!" :mss2="forCom"></first-com>
</div>
</body>
<script src= "http://unpkg.com/vue@2.5.17/dist/vue.min.js"></script>
<script src= "index.js"></script>
<script type="text/javascript">
Vue.component("first-com", {
props: {
mss1:String,
mss2:{
type:Number, //****
required:true
}
},
template: "<div>{{mss1}}{{mss2}}</div>",
})
var v1 = new Vue({
el: "-sharpapp1",
data: {
message: "",
forCom: ""
}
})
</script>
</html>