1、若傳值只是一個(gè)簡單的字符串或數(shù)字,就不能加:
父組件
<toast message="msg"></toast>
<!-- <toast :message="msg"></toast> 會(huì)報(bào)錯(cuò) -->
子組件
props:{
message:{
type:String,
default:''
}
}
父組件
<toast message="msg"></toast>
<!-- <toast :message="msg"></toast> 會(huì)報(bào)錯(cuò) -->
子組件
props:{
message:{
type:String,
default:''
}
}