不使用以上技術時我們一般是使用ref
<Son ref="son" />
methods:{
parentMethod() {
console.log(this.$refs.son) //返回的是一個vue對象,所以可以直接調用其方法
this.$refs.son.childMethod(this.flag);
}
}
使用以上技術的情況下
(this.$refs.son as any).childMethod()