子 (group.vue)
<template>
<div>
<button @click="btnClick"></button>
</div>
</template>
<script>
export default {
data () {
return {
name: 'jick',
age: '12',
color: 'red'
}
},
methods: {
btnClick () {
this.$emit('btnClick', this.name, this.age, this.color)
}
}
}
</script>
父
<template>
<div>
<group @btnClick="pClick"></group>
</div>
</template>
<script>
import group from './group'
export default {
components: {
group
},
data () {
return {
}
},
methods: {
pClick (msg) {
// 输入子传入的参数
console.log(msg[0], msg[1], msg[2]);
}
}
}
</script>