组件之间的传值-$refs&$parent

首先你的给子组件做标记。demo :<son-component ref="mySon"></son-component>

然后在父组件中,通过this.$refs.就可以访问了这个子组件了,包括访问自组件的data里面的数据,调用它的函数

然后在子组件中,通过this.$parent就可以访问父组件了。当然也包括里面的数据了。

原文地址:https://www.cnblogs.com/yzxyzx/p/11870940.html