Non-props属性指的是父组件给子组件传值,子组件不去接收
const app = Vue.createApp({
data(){
return{
message:'hello world',
}
},
template:'<div>{
{message}} <test num="123"></test></div>',
});
app.component('test',{
template:`<div>test</div>`
})
app.mount('#app')
当子组件不去用props去接收的时候,显示
<div num="123">test</div>
当不想显示num属性 :
可以用 inhertAttrs: false 取消显示
const app = Vue.createApp({
data(){
return{
message:'hello world',
}
},
template:'<div>{
{message}} <test num="123"></test></div>',
});
app.component('test',{
inheritAttrs: false,
template:`<div>test</div>`
})
app.mount('#app')