learnin-some-vue/app.js

30 lines
451 B
JavaScript
Raw Normal View History

2018-04-13 14:54:53 +00:00
var app = new Vue({
el: '#app',
data: {
2018-04-13 18:27:33 +00:00
counter: 0,
secondCounter: 0,
2018-04-13 14:56:49 +00:00
},
2018-04-13 18:27:33 +00:00
methods: {
result(){
console.log("result");
return this.counter >= 5 ? ">=5" : "<5"
}
},
2018-04-13 18:31:39 +00:00
watch: {
counter(value){
var vm = this;
setTimeout(function(){
vm.counter = 0;
}, 2000)
}
},
2018-04-13 18:27:33 +00:00
computed: {
output(){
console.log("computed");
return this.counter >= 5 ? ">=5" : "<5"
}
}
2018-04-13 14:54:53 +00:00
})