- 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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -93,8 +93,7 @@
|
||||
:input-class="myclass"
|
||||
:options="valori"
|
||||
:option-value="optval"
|
||||
:option-label="optlab"
|
||||
map-options
|
||||
:option-label="getOptionLabel"
|
||||
:use-chips="myvalue && myvalue !== '' ? true : false"
|
||||
stack-label
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
@@ -125,7 +124,8 @@
|
||||
<q-item v-bind="scope.itemProps">
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}</q-item-label
|
||||
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}
|
||||
</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
Reference in New Issue
Block a user