Skip to content

Commit

Permalink
Change select from v-bind to v-model
Browse files Browse the repository at this point in the history
  • Loading branch information
billangli committed Jul 25, 2020
1 parent 7a39a23 commit 435896a
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/components/InputTimeInterval.vue
Expand Up @@ -18,7 +18,7 @@ div
th.pr-2
label(for="duration") Show last:
td
select(id="duration" :value="duration" @change="valueChanged")
select(id="duration" v-model="duration" @change="valueChanged")
option(:value="15*60") 15min
option(:value="30*60") 30min
option(:value="60*60") 1h
Expand Down Expand Up @@ -74,14 +74,6 @@ export default {
return [moment().subtract(this.duration, 'seconds'), moment()];
}
},
set(newValue) {
if (!isNaN(newValue) && newValue != '') {
// Set new duration
this.duration = newValue;
} else {
// Not required for mode='range', start and end set directly through v-model
}
},
},
emptyDaterange() {
return !(this.start && this.end);
Expand All @@ -94,14 +86,11 @@ export default {
},
},
methods: {
valueChanged(e) {
console.log('valueChanged');
valueChanged() {
if (
this.mode == 'last_duration' ||
(!this.emptyDaterange && !this.invalidDaterange && !this.daterangeTooLong)
) {
console.log('entered if');
this.value = e.target.value;
this.$emit('input', this.value);
}
},
Expand Down

0 comments on commit 435896a

Please sign in to comment.