Skip to content

Instantly share code, notes, and snippets.

@avermeulen
Created October 25, 2018 12:08
Show Gist options
  • Save avermeulen/bc4fad9f5f53d5dc3b9c87f171081e12 to your computer and use it in GitHub Desktop.
Save avermeulen/bc4fad9f5f53d5dc3b9c87f171081e12 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/zonaxiq
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
</head>
<body>
<div class="app">
<button-counter v-if="show" v-bind:msg="show"></button-counter>
</div>
<script id="jsbin-javascript">
Vue.component('button-counter', {
props : ['msg'],
data: function () {
return {
count: 0
}
},
template: '<button v-on:click="count++">You clicked me {{ count }} times. {{msg}} </button>'
})
new Vue({
el: '.app',
data: {
show : "go!"
},
mounted : function() {
setTimeout(() => this.show = "", 3000);
setTimeout(() => this.show = "ahoy!", 6000);
}
})
</script>
<script id="jsbin-source-javascript" type="text/javascript">
Vue.component('button-counter', {
props : ['msg'],
data: function () {
return {
count: 0
}
},
template: '<button v-on:click="count++">You clicked me {{ count }} times. {{msg}} </button>'
})
new Vue({
el: '.app',
data: {
show : "go!"
},
mounted : function() {
setTimeout(() => this.show = "", 3000);
setTimeout(() => this.show = "ahoy!", 6000);
}
})
</script></body>
</html>
Vue.component('button-counter', {
props : ['msg'],
data: function () {
return {
count: 0
}
},
template: '<button v-on:click="count++">You clicked me {{ count }} times. {{msg}} </button>'
})
new Vue({
el: '.app',
data: {
show : "go!"
},
mounted : function() {
setTimeout(() => this.show = "", 3000);
setTimeout(() => this.show = "ahoy!", 6000);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment