feat: use withDefaults for SelectProject
This commit is contained in:
parent
5545b0e447
commit
fd12c8705e
@ -11,7 +11,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, ref, shallowReactive, watchEffect, type PropType} from 'vue'
|
import {computed, ref, shallowReactive, watchEffect} from 'vue'
|
||||||
|
|
||||||
import Multiselect from '@/components/input/Multiselect.vue'
|
import Multiselect from '@/components/input/Multiselect.vue'
|
||||||
|
|
||||||
@ -20,23 +20,16 @@ import type {IProject} from '@/modelTypes/IProject'
|
|||||||
import ProjectService from '@/services/project'
|
import ProjectService from '@/services/project'
|
||||||
import {includesById} from '@/helpers/utils'
|
import {includesById} from '@/helpers/utils'
|
||||||
|
|
||||||
type ProjectFilterFunc = (p: IProject) => boolean
|
const props = withDefaults(defineProps<{
|
||||||
|
modelValue: IProject[],
|
||||||
const props = defineProps({
|
projectFilter: (p: IProject) => boolean
|
||||||
modelValue: {
|
}>(), {
|
||||||
type: Array as PropType<IProject[]>,
|
modelValue: () => [],
|
||||||
default: () => [],
|
projectFilter: () => () => true,
|
||||||
},
|
|
||||||
projectFilter: {
|
|
||||||
type: Function as PropType<ProjectFilterFunc>,
|
|
||||||
default: () => {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
return (_: IProject) => true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: IProject[]): void
|
'update:modelValue': [value: IProject[]]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const projects = ref<IProject[]>([])
|
const projects = ref<IProject[]>([])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user