mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-01 03:31:58 +00:00
lint: Fix missing defaults for Props with Defaults (#5439)
This commit is contained in:
@@ -57,7 +57,9 @@ interface Emits {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
disabled: false
|
disabled: false,
|
||||||
|
optionLabel: 'label',
|
||||||
|
optionValue: 'value'
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<Emits>()
|
const emit = defineEmits<Emits>()
|
||||||
@@ -65,8 +67,7 @@ const emit = defineEmits<Emits>()
|
|||||||
// handle both string/number arrays and object arrays with PrimeVue compatibility
|
// handle both string/number arrays and object arrays with PrimeVue compatibility
|
||||||
const getOptionValue = (option: T, index: number): string => {
|
const getOptionValue = (option: T, index: number): string => {
|
||||||
if (typeof option === 'object' && option !== null) {
|
if (typeof option === 'object' && option !== null) {
|
||||||
// Use PrimeVue optionValue prop if provided, otherwise fallback to common fields
|
const valueField = props.optionValue
|
||||||
const valueField = props.optionValue ?? 'value'
|
|
||||||
const value =
|
const value =
|
||||||
(option as any)[valueField] ??
|
(option as any)[valueField] ??
|
||||||
(option as any).value ??
|
(option as any).value ??
|
||||||
@@ -81,8 +82,7 @@ const getOptionValue = (option: T, index: number): string => {
|
|||||||
// for display with PrimeVue compatibility
|
// for display with PrimeVue compatibility
|
||||||
const getOptionLabel = (option: T): string => {
|
const getOptionLabel = (option: T): string => {
|
||||||
if (typeof option === 'object' && option !== null) {
|
if (typeof option === 'object' && option !== null) {
|
||||||
// Use PrimeVue optionLabel prop if provided, otherwise fallback to common fields
|
const labelField = props.optionLabel
|
||||||
const labelField = props.optionLabel ?? 'label'
|
|
||||||
return (
|
return (
|
||||||
(option as any)[labelField] ??
|
(option as any)[labelField] ??
|
||||||
(option as any).label ??
|
(option as any).label ??
|
||||||
|
|||||||
Reference in New Issue
Block a user