html code:
<prop-ver :prop-a="num" :prop-b="num2"></prop-ver>
js code:
var propVer={
prop:{
propA:{
type:Number,
default:100
},
propB:{
type:Number,
default:100
}
},
tempalte:'<p>{{propA}}------{{propB}}</p>'
};
new Vue({
el:'#el',
data:{
num:'222',
num2:222
},
components:{
'prop-ver':propVer
}
});
The code is as above. "I feel that default is useless and has no prompts or effects.
Solved: I originally thought that the value passed in did not meet the type requirements, and then the default value was used. It turns out to be the default value when there is no value
我想大声告诉你2017-05-19 10:43:31
The default value, because you passed num and num2 to the two props, the default value is overwritten
怪我咯2017-05-19 10:43:31
Resolved: I thought default was the value passed in if it did not meet the type requirements, and then it was the default value. It turns out to be the default value when there is no value