Skip to content

Instantly share code, notes, and snippets.

@AnandShiva
Last active June 21, 2020 11:04
Show Gist options
  • Save AnandShiva/f36e3e3e710c5e4a66dbcba979ce666e to your computer and use it in GitHub Desktop.
Save AnandShiva/f36e3e3e710c5e4a66dbcba979ce666e to your computer and use it in GitHub Desktop.
Button.vue example component
// src/components/button.vue eg
<template>
<button class="button" @click="buttonClicked">{{text}}</button>
</template>
<script>
export default {
props:{
text:{
type: String,
default: 'default button action'
}
},
methods:{
buttonClicked(event){
this.$emit('my-button-click',event)
}
}
}
</script>
<style>
.button {
background-color: #4caf50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment