vue学习笔记15 component 组件 props属性

定义属性我们需要用props选项,加上数组形式的属性名称,例如:props:[‘here’]

components:{

  "laohan":{

    template:``,

    props:[]

}

}

如果属性名称里有“-”  要用小驼峰式写法props:[‘formHere’]

这时我们可以给属性bind 传递值

data:{

  message:'你好'

}

<laohan :here="message"></laohan>

猜你喜欢

转载自www.cnblogs.com/laohange/p/12825541.html