Skip to content

Instantly share code, notes, and snippets.

@shailen-naidoo
Created December 10, 2018 09:02
Show Gist options
  • Save shailen-naidoo/5d30c61740def58c4ba51cb17741a3c6 to your computer and use it in GitHub Desktop.
Save shailen-naidoo/5d30c61740def58c4ba51cb17741a3c6 to your computer and use it in GitHub Desktop.
Vue component using Vue.component()
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
</head>
<body>
<div id="app">
<my-button-counter></my-button-counter>
</div>
</body>
<script>
Vue.component("my-button-counter",{
template`
<button v-on:click="count++">
counter
</button>
`,
data() {
return {
count: 0
}
}
})
</script>
<script>
new Vue({ el: "#app" });
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment