【发布时间】:2022-01-23 11:26:53
【问题描述】:
我有一个包含两个按钮的组件,每个按钮都有一个独特的功能:
<template>
<v-container>
<v - button ref = "button" / >
<v - button ref = "buttons" / >
</v-container>
</template>
我想如何解决父级中的两个按钮并应用我的两个功能,我已经写在父级上。
<Button @click="refer to the two buttons" />
...
<script>
methodOne(){
console.log("A")
}
methodTwo() {
console.log("B")
}
</script>
我只是不知道如何正确地做到这一点。简而言之:子组件中有多个按钮,父组件中有多个功能,当子组件中的按钮被触发时应该触发。
【问题讨论】:
标签: vue.js vue-component