Created
October 25, 2018 12:08
-
-
Save avermeulen/bc4fad9f5f53d5dc3b9c87f171081e12 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/zonaxiq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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