我新建了一個(gè)自定義按鈕組件MyButton浸船,如果想在A(yíng)pp.vue中使用該組件宴偿,并給組件添加App.vue中的方法钠至,在方法中添加一個(gè)修飾符.native
MyButtton:
<template>
<div id="my-button">
<button>自定義按鈕</button>
</div>
</template>
<style scoped>
#my-button button{
width: 100px;
height: 30px;
background: pink;
color: #fff;
}
</style>
App.vue
import MyButton from './components/myButton.vue'
components:{
MyButton
}
<MyButton @click.native="send"></MyButton>