- Ricerca Titolo per nome o autore o ISBN o codice articolo
This commit is contained in:
@@ -761,6 +761,31 @@ export default defineComponent({
|
||||
// Seleziona tutto il testo all'interno della casella di testo
|
||||
event.target.select();
|
||||
}
|
||||
|
||||
function getLabelValue(opt: any): string {
|
||||
const collabel = props.optlab
|
||||
|
||||
if (typeof collabel === 'function') {
|
||||
// Se collabel è una funzione, chiamala con opt
|
||||
return collabel(opt)
|
||||
} else if (typeof collabel === 'string') {
|
||||
// Se collabel è una stringa, usa il valore della proprietà corrispondente
|
||||
return opt[collabel] || 'N/A'
|
||||
}
|
||||
|
||||
// Fallback generico
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
function getOptionLabel(option: any): string {
|
||||
console.log('getOptionLabel', option)
|
||||
if (typeof props.optlab === 'function') {
|
||||
return props.optlab(option); // Se optlab è una funzione, chiamala
|
||||
} else {
|
||||
return option[props.optlab]; // Se optlab è una stringa, usa la proprietà corrispondente
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
|
||||
@@ -777,6 +802,8 @@ export default defineComponent({
|
||||
getIcon,
|
||||
tools,
|
||||
selectText,
|
||||
getLabelValue,
|
||||
getOptionLabel,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user