在vue中 父组件给子组件传值 可以用到props属性进行传值。 今天就给大家讲讲props的使用方法: 父页面:father.vue
<template
>
<children
:mssage
="msg"></children
>
</template
>
<script
>
improt children form
'../../children.vue';
export default {
compontent
:{
children
},
data(){
return{
msg
:'我是msg的值'
}
}
}
</script
>
子页面:children.vue
<template
>
<div
>{{mssage
}}</div
>
</template
>
export default {
props
:{
type
:String
,
required
:true
}
}
至此,由父页面的值 就这样传过来了。
请注意打赏和关注哟:
转载请注明原文地址:https://ipadbbs.8miu.com/read-26826.html