perf: vnSelectPaginate
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-07-05 21:01:22 +02:00
parent e92701de23
commit 70ba68393e
2 changed files with 11 additions and 1 deletions

View File

@ -87,7 +87,11 @@ const selectValue = computed({
return $props.modelValue;
},
set(value) {
isFiltered = false;
filterValue.value = !!value;
arrayData.store.page = 0;
arrayData.store.hasMoreData = true;
emit('update:modelValue', value);
},
});
@ -95,7 +99,8 @@ const selectValue = computed({
const useURL = computed(() => $props.url);
const $attrs = useAttrs();
const arrayDataKey = $props.dataKey ?? ($props.url !== '' ? $props.url : $attrs.label);
const arrayDataKey =
$props.dataKey ?? ($props.url.length > 0 ? $props.url : $attrs.label);
const arrayDataOptions = {
url: $props.url,
where: $props.where,
@ -164,6 +169,10 @@ async function fetchFilter(val) {
}
let isFiltered = false;
watch(filterValue, (newVal, oldVal) => {
// if (vnSelectRef.value.modelValue) {
// isFiltered = true;
// return;
// }
const _isFiltered = oldVal?.length < newVal?.length;
if (!_isFiltered && isFiltered) {
arrayData.store.hasMoreData = true;

View File

@ -104,6 +104,7 @@ const contactChannels = ref([]);
:where="{ role: 'salesPerson' }"
emit-value
map-options
clearable
option-label="name"
option-value="id"
option-filter="firstName"