refs #5673 fix(vnSelectFilter): update options
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-08-04 08:57:11 +02:00
parent 0cb925abc3
commit 35ac3afe81
2 changed files with 21 additions and 7 deletions

View File

@ -18,22 +18,24 @@ const $props = defineProps({
});
const updateValue = (newValue) => emit('update:modelValue', newValue);
const updateOptions = (newValue) => emit('update:options', newValue);
const { modelValue } = toRefs($props);
const { modelValue, options, optionLabel } = toRefs($props);
function filterFn(val, update) {
update(
() => {
const needle = val.toLowerCase();
console.log($props.options);
// $props.options.value = options.value.filter(
// (v) => v[$props.optionLabel.value].toLowerCase().indexOf(needle) > -1
// );
updateOptions(
$props.options.filter(
(v) => v[$props.optionLabel].toLowerCase().indexOf(needle) > -1
)
// updateOptions(
// $props.options.filter(
// (v) => v[$props.optionLabel].toLowerCase().indexOf(needle) > -1
// )
// );
const filteredOptions = options.value.filter(
(v) => v[optionLabel.value].toLowerCase().indexOf(needle) > -1
);
emit('update:options', filteredOptions);
},
(ref) => {
ref.setOptionIndex(-1);

View File

@ -147,6 +147,12 @@ const columns = computed(() => [
:label="col.label"
v-model="row[col.model]"
:options="col.options"
@update:options="
(newOptions) => {
console.log(newOptions);
col.options = newOptions;
}
"
:option-value="col.optionValue"
:option-label="col.optionLabel"
/>
@ -166,6 +172,12 @@ const columns = computed(() => [
:label="col.label"
v-model="props.row[col.model]"
:options="col.options"
@update:options="
(newOptions) => {
console.log(newOptions);
col.options = newOptions;
}
"
:option-value="col.optionValue"
:option-label="col.optionLabel"
dense