s2e25 shorthands
This commit is contained in:
parent
d3bdeee2a3
commit
12053e4e2b
23
app.js
23
app.js
@ -1,28 +1,11 @@
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
counter: 0,
|
||||
secondCounter: 0,
|
||||
link: 'https://tyrelsouza.com',
|
||||
},
|
||||
methods: {
|
||||
result(){
|
||||
console.log("result");
|
||||
return this.counter >= 5 ? ">=5" : "<5"
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
counter(value){
|
||||
var vm = this;
|
||||
setTimeout(function(){
|
||||
vm.counter = 0;
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
output(){
|
||||
console.log("computed");
|
||||
return this.counter >= 5 ? ">=5" : "<5"
|
||||
|
||||
changeLink(){
|
||||
this.link = "https://tyrel.bike";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,14 +6,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id='app'>
|
||||
<button v-on:click="counter++">Increase</button>
|
||||
<button v-on:click="counter--">Decrease</button>
|
||||
<button v-on:click="secondCounter++">Increase 2nd Counter</button>
|
||||
<p>counter: {{counter}} | {{secondCounter}}</p>
|
||||
<p>result: {{result()}} | {{ output }}</p>
|
||||
<button @click="changeLink">Change to Link</button>
|
||||
<a :href='link'>Link</a>
|
||||
</div>
|
||||
|
||||
<script src="app.js" charset="utf-8"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user