fix(frontend): Fix all type issues
This commit is contained in:
@@ -14,15 +14,16 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const modelValue = computed({
|
||||
get: () => props.formOptions?.[0].value === 'true',
|
||||
get: () => props.formOptions[0]?.value === 'true',
|
||||
set: (val) => {
|
||||
if (props.formOptions?.[0]) {
|
||||
const firstOption = props.formOptions[0]
|
||||
if (firstOption) {
|
||||
const updatedModelValue = [...props.formOptions]
|
||||
updatedModelValue[0] = { ...updatedModelValue[0], value: val.toString() }
|
||||
updatedModelValue[0] = { ...firstOption, value: val.toString() }
|
||||
emit('update:formOptions', updatedModelValue)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const label = computed(() => props.formOptions?.[0].label ?? '')
|
||||
const label = computed(() => props.formOptions[0]?.label ?? '')
|
||||
</script>
|
||||
|
||||
@@ -17,11 +17,12 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const modelValue = computed({
|
||||
get: () => props.formOptions?.[0].value ?? '',
|
||||
get: () => props.formOptions[0]?.value ?? '',
|
||||
set: (val) => {
|
||||
if (val && props.formOptions?.[0].value) {
|
||||
const firstOption = props.formOptions[0]
|
||||
if (val && firstOption) {
|
||||
const updatedModelValue = [...props.formOptions]
|
||||
updatedModelValue[0] = { ...updatedModelValue[0], value: val.toString() }
|
||||
updatedModelValue[0] = { ...firstOption, value: val.toString() }
|
||||
emit('update:formOptions', updatedModelValue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,16 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const modelValue = computed({
|
||||
get: () => props.formOptions?.[0].value === 'true',
|
||||
get: () => props.formOptions[0]?.value === 'true',
|
||||
set: (val) => {
|
||||
if (props.formOptions?.[0]) {
|
||||
const firstOption = props.formOptions[0]
|
||||
if (firstOption) {
|
||||
const updatedModelValue = [...props.formOptions]
|
||||
updatedModelValue[0] = { ...updatedModelValue[0], value: val.toString() }
|
||||
updatedModelValue[0] = { ...firstOption, value: val.toString() }
|
||||
emit('update:formOptions', updatedModelValue)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const label = computed(() => props.formOptions?.[0].label ?? '')
|
||||
const label = computed(() => props.formOptions[0]?.label ?? '')
|
||||
</script>
|
||||
|
||||
@@ -23,33 +23,39 @@ const SEPARATOR = '|||'
|
||||
|
||||
const title = computed({
|
||||
get: () => {
|
||||
const currentValue = props.formOptions?.[0]?.value ?? ''
|
||||
const currentValue = props.formOptions[0]?.value ?? ''
|
||||
return splitValue(currentValue).title
|
||||
},
|
||||
set: (newTitle: string) => {
|
||||
const currentValue = props.formOptions?.[0]?.value ?? ''
|
||||
const { body: currentBody } = splitValue(currentValue)
|
||||
const combinedValue = joinValue(newTitle, currentBody)
|
||||
const firstOption = props.formOptions[0]
|
||||
if (firstOption) {
|
||||
const currentValue = firstOption.value ?? ''
|
||||
const { body: currentBody } = splitValue(currentValue)
|
||||
const combinedValue = joinValue(newTitle, currentBody)
|
||||
|
||||
const updatedModelValue = [...props.formOptions]
|
||||
updatedModelValue[0] = { ...updatedModelValue[0], value: combinedValue }
|
||||
emit('update:formOptions', updatedModelValue)
|
||||
const updatedModelValue = [...props.formOptions]
|
||||
updatedModelValue[0] = { ...firstOption, value: combinedValue }
|
||||
emit('update:formOptions', updatedModelValue)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const body = computed({
|
||||
get: () => {
|
||||
const currentValue = props.formOptions?.[0]?.value ?? ''
|
||||
const currentValue = props.formOptions[0]?.value ?? ''
|
||||
return splitValue(currentValue).body
|
||||
},
|
||||
set: (newBody: string) => {
|
||||
const currentValue = props.formOptions?.[0]?.value ?? ''
|
||||
const { title: currentTitle } = splitValue(currentValue)
|
||||
const combinedValue = joinValue(currentTitle, newBody)
|
||||
const firstOption = props.formOptions[0]
|
||||
if (firstOption) {
|
||||
const currentValue = firstOption.value ?? ''
|
||||
const { title: currentTitle } = splitValue(currentValue)
|
||||
const combinedValue = joinValue(currentTitle, newBody)
|
||||
|
||||
const updatedModelValue = [...props.formOptions]
|
||||
updatedModelValue[0] = { ...updatedModelValue[0], value: combinedValue }
|
||||
emit('update:formOptions', updatedModelValue)
|
||||
const updatedModelValue = [...props.formOptions]
|
||||
updatedModelValue[0] = { ...firstOption, value: combinedValue }
|
||||
emit('update:formOptions', updatedModelValue)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user