vue 父组件调用子组件的方法

vue 父组件调用子组件的方法

父组件:

html:
<component-name ref="componentref"></component-name> //子组件名称 js:
this.$refs.componentref.show();//在你需要的地方,调用即可

子组件:

methods:{
        show(){
            console.log('我是子组件方法,你调用到我了哦');
        }
    }
原文地址:https://www.cnblogs.com/lulianlian/p/7683066.html