fix: use vue3 v-model bindings

see: https://v3.vuejs.org/guide/migration/v-model.html
This commit is contained in:
Dominik Pschenitschni 2021-08-23 21:18:12 +02:00
parent 2ef2bb7700
commit 51a740f53c
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
29 changed files with 114 additions and 96 deletions

View file

@ -1,6 +1,6 @@
<template>
<div class="select">
<select :disabled="disabled || null" @change="updateData" v-model.number="percentDone">
<select :disabled="disabled || null" v-model.number="percentDone">
<option value="0">0%</option>
<option value="0.1">10%</option>
<option value="0.2">20%</option>
@ -19,13 +19,8 @@
<script>
export default {
name: 'percentDoneSelect',
data() {
return {
percentDone: 0,
}
},
props: {
value: {
modelValue: {
default: 0,
type: Number,
},
@ -33,19 +28,16 @@ export default {
default: false,
},
},
watch: {
// Set the priority to the :value every time it changes from the outside
value(newVal) {
this.percentDone = newVal
},
},
mounted() {
this.percentDone = this.value
},
methods: {
updateData() {
this.$emit('input', this.percentDone)
this.$emit('change')
emits: ['update:modelValue', 'change'],
computed: {
percentDone: {
get() {
return this.modelValue
},
set(percentDone) {
this.$emit('update:modelValue', percentDone)
this.$emit('change')
},
},
},
}