vue之父子组件通信
生活随笔
收集整理的这篇文章主要介绍了
vue之父子组件通信
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
一. 父-子组件间通信
let children={
template:`<div><h1>{{send}}</h1></div>`, # 将传过来的信息send渲染出来
props:['send'] # 通过props来获取父级传过来的信息
};
let parent={
components:{xx:children},
template:'<xx v-bind:send="num"></xx>', # 自定义个绑定属相send,从data中
data(){return {num:6688}} # 获取num值,传给send属相
};
new Vue({
el:'#app',
components:{parent},
template:'<parent></parent>'
})
转载于:https://www.cnblogs.com/quzq/p/10023068.html
总结
以上是生活随笔为你收集整理的vue之父子组件通信的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 27-----BBS论坛
- 下一篇: vue 点击倒计时 ajax 封装