feat: percentDoneSelect script setup
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dominik Pschenitschni 2022-04-23 19:32:08 +02:00
parent ae93bbd781
commit 95d7f45ea1
Signed by: dpschen
GPG Key ID: B257AC0149F43A77
1 changed files with 23 additions and 24 deletions

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="select"> <div class="select">
<select :disabled="disabled || null" v-model.number="percentDone"> <select
v-model.number="percentDone"
:disabled="disabled || undefined"
>
<option value="0">0%</option> <option value="0">0%</option>
<option value="0.1">10%</option> <option value="0.1">10%</option>
<option value="0.2">20%</option> <option value="0.2">20%</option>
@ -16,30 +19,26 @@
</div> </div>
</template> </template>
<script lang="ts"> <script setup lang="ts">
import {defineComponent} from 'vue' import {computed} from 'vue'
export default defineComponent({
name: 'percentDoneSelect', const props = defineProps({
props: { modelValue: {
modelValue: { default: 0,
default: 0, type: Number,
type: Number,
},
disabled: {
default: false,
},
}, },
emits: ['update:modelValue', 'change'], disabled: {
computed: { default: false,
percentDone: { },
get() { })
return this.modelValue
}, const emit = defineEmits(['update:modelValue', 'change'])
set(percentDone) {
this.$emit('update:modelValue', percentDone) const percentDone = computed({
this.$emit('change') get: () => props.modelValue,
}, set(percentDone) {
}, emit('update:modelValue', percentDone)
emit('change')
}, },
}) })
</script> </script>