代码中,Helloword是子组件
<template>
<div class="index">
<Header></Header>
<HelloWorld></HelloWorld>
<button @click="goPro">跳转</button>
</div>
</template>
mounted(){
console.log(this.$children)
}
用ref绑定子组件,在父组件中通过$refs取对应的值或者方法
<HelloWorld ref="hello"></HelloWorld>
this.$refs.hello.属性 this.$refs.hello.方法
原文:https://www.cnblogs.com/xieoxie3000question/p/13031054.html