ESC-240: Fix null pointer exception in SelectInput getOptionName method
This commit is contained in:
parent
797c1ceab5
commit
2f0f87267f
|
|
@ -156,17 +156,19 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
getOptionName(val) {
|
||||
if (val == null) return ''
|
||||
const option = this.finalOptions.find((optionCandidate) => {
|
||||
return optionCandidate[this.optionKey] === val ||
|
||||
(typeof val === 'object' && optionCandidate[this.optionKey] === val[this.optionKey])
|
||||
return optionCandidate && optionCandidate[this.optionKey] === val ||
|
||||
(typeof val === 'object' && val && optionCandidate && optionCandidate[this.optionKey] === val[this.optionKey])
|
||||
})
|
||||
if (option) return option[this.displayKey]
|
||||
return null
|
||||
if (option && option[this.displayKey] !== undefined) {
|
||||
return option[this.displayKey]
|
||||
}
|
||||
return val.toString() // Convert to string to ensure it's not null
|
||||
},
|
||||
getOptionNames(values) {
|
||||
return values.map(val => {
|
||||
return this.getOptionName(val)
|
||||
})
|
||||
if (!Array.isArray(values)) return []
|
||||
return values.map(val => this.getOptionName(val)).filter(Boolean)
|
||||
},
|
||||
updateModelValue(newValues) {
|
||||
if (newValues === null) newValues = []
|
||||
|
|
|
|||
|
|
@ -60,6 +60,11 @@ export default defineNuxtConfig({
|
|||
project: "opnform-vue",
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
hmr: {
|
||||
clientPort: 3000
|
||||
}
|
||||
}
|
||||
},
|
||||
tailwindcss: {
|
||||
cssPath: ['~/scss/app.scss']
|
||||
|
|
|
|||
Loading…
Reference in New Issue