使用vue封装了一个按钮的组件, 但在页面上使用时的点击事件无法生效,也无报错
//myButton
<template>
<button :type="type" :class="classes" :disabled="disabled">
<slot>{{label}}</slot>
</button>
</template>
//App.vue
<my-button :type="button" @click="open">按钮</my-button>
使用vue封装了一个按钮的组件, 但在页面上使用时的点击事件无法生效,也无报错
//myButton
<template>
<button :type="type" :class="classes" :disabled="disabled">
<slot>{{label}}</slot>
</button>
</template>
//App.vue
<my-button :type="button" @click="open">按钮</my-button>
9 回答1.7k 阅读✓ 已解决
6 回答1.6k 阅读
3 回答1.4k 阅读✓ 已解决
4 回答1.3k 阅读✓ 已解决
3 回答1.1k 阅读
2 回答1.3k 阅读✓ 已解决
3 回答1.4k 阅读✓ 已解决
使用-v-on-绑定自定义事件