30 lines
451 B
JavaScript
30 lines
451 B
JavaScript
var app = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
counter: 0,
|
|
secondCounter: 0,
|
|
},
|
|
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"
|
|
|
|
}
|
|
}
|
|
|
|
})
|