子组件
<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>