feat: add withDefaults and emit types to PrioritySelect
This commit is contained in:
parent
ddc18aa177
commit
aaa2abced4
@ -3,7 +3,6 @@
|
|||||||
<select
|
<select
|
||||||
v-model="priority"
|
v-model="priority"
|
||||||
:disabled="disabled || undefined"
|
:disabled="disabled || undefined"
|
||||||
@change="updateData"
|
|
||||||
>
|
>
|
||||||
<option :value="PRIORITIES.UNSET">
|
<option :value="PRIORITIES.UNSET">
|
||||||
{{ $t('task.priority.unset') }}
|
{{ $t('task.priority.unset') }}
|
||||||
@ -28,32 +27,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, watch} from 'vue'
|
|
||||||
import {PRIORITIES} from '@/constants/priorities'
|
import {PRIORITIES} from '@/constants/priorities'
|
||||||
|
|
||||||
const props = defineProps({
|
withDefaults(defineProps<{
|
||||||
modelValue: {
|
disabled?: boolean
|
||||||
type: Number,
|
}>(), {
|
||||||
default: 0,
|
disabled: false,
|
||||||
},
|
|
||||||
disabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['update:modelValue'])
|
|
||||||
|
|
||||||
const priority = ref(0)
|
const priority = defineModel<number>({
|
||||||
|
required: true,
|
||||||
|
default: 0,
|
||||||
|
})
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.modelValue,
|
|
||||||
(value) => {
|
|
||||||
priority.value = value
|
|
||||||
},
|
|
||||||
{immediate: true},
|
|
||||||
)
|
|
||||||
|
|
||||||
function updateData() {
|
|
||||||
emit('update:modelValue', priority.value)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user