-
子组件
<template>
<div>
</div>
</template>
<script>
export default {
methods: {
childEvent() {
alert("我是子组件方法");
}
}
};
</script>
-
父组件
<template>
<div>
<child ref="child"/>
</div>
</template>
<script>
import child from './child';
export default {
components: {
child
},
methods: {
parentEvent() {
this.$refs.child.childEvent();
}
}
};
</script>
标签:Vue,methods,default,child,组件,调子,childEvent
From: https://www.cnblogs.com/IT-IOS-MAN/p/16891354.html