父組件
<template>
<div>
<child @fatherMethod="fatherMethod"></child>
</div>
</template>
<script>
import child from '~/components/dam/child';
export default {
components: {
child
},
methods: {
fatherMethod(data) {
console.log('測試');
}
}
};
</script>
子組件
<template>
<div>
<button @click="childMethod()">點擊</button>
</div>
</template>
<script>
export default {
methods: {
childMethod() {
this.$emit('fatherMethod',data);
}
}
};
</script>
