组件之间传递获取数据的方法
🎈父组件获取子组件的数据和方法
- 调用子组件的时候 定义一个ref
<select ref="some"></headerchild>
- 在父组件里面通过this.$refs.some获取到子组件实例,则可以此调用子组件的方法、属性而获得相关数据
this.$refs.some.属性 this.$refs.some.方法
🎈子组件获取父组件的数据和方法
this.$parent.属性 this.$parent.方法
<select ref="some"></headerchild>
this.$refs.some.属性 this.$refs.some.方法
this.$parent.属性 this.$parent.方法