mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-12 18:22:49 +01:00
fix: multi select state handling (#1094)
This commit is contained in:
@@ -1,24 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Textarea } from '@/components/ui/textarea'
|
|
||||||
|
|
||||||
import { useVModel } from '@vueuse/core'
|
|
||||||
import { type HTMLAttributes, onMounted, ref } from 'vue'
|
import { type HTMLAttributes, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
class?: HTMLAttributes['class']
|
class?: HTMLAttributes['class']
|
||||||
defaultValue?: string | number
|
|
||||||
modelValue?: string | number
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emits = defineEmits<{
|
const modelValue = defineModel<string>({
|
||||||
(e: 'update:modelValue', payload: string | number): void
|
default: ''
|
||||||
}>()
|
|
||||||
|
|
||||||
const modelValue = useVModel(props, 'modelValue', emits, {
|
|
||||||
passive: true,
|
|
||||||
defaultValue: props.defaultValue
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const textarea = ref<HTMLElement | null>(null)
|
const textarea = ref<HTMLElement | null>(null)
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ const selectedItems = ref<string[]>(props.modelValue)
|
|||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => selectedItems.value,
|
() => selectedItems.value,
|
||||||
(value) => emit('update:modelValue', value)
|
(value) => emit('update:modelValue', value),
|
||||||
|
{ deep: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
const filteredItems = computed(() => {
|
const filteredItems = computed(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user