perf: use $props.params
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
e2e7bacca0
commit
88e5dd08b8
|
@ -3,7 +3,6 @@ import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useAttrs } from 'vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
||||
const $props = defineProps({
|
||||
|
@ -111,34 +110,17 @@ const selectValue = computed({
|
|||
return $props.modelValue;
|
||||
},
|
||||
set(value) {
|
||||
// arrayData.store.page = 0;
|
||||
// arrayData.store.hasMoreData = true;
|
||||
setOptions(myOptionsOriginal.value);
|
||||
emit('update:modelValue', value);
|
||||
},
|
||||
});
|
||||
|
||||
// watch(options, (newValue) => {
|
||||
// setOptions(newValue);
|
||||
// });
|
||||
|
||||
// watch(modelValue, (newValue) => {
|
||||
// if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
|
||||
// fetchFilter(newValue);
|
||||
// });
|
||||
|
||||
// onMounted(() => {
|
||||
// setOptions(options.value);
|
||||
// if (useURL.value && $props.modelValue && !findKeyInOptions())
|
||||
// fetchFilter($props.modelValue);
|
||||
// if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||
// });
|
||||
|
||||
const $attrs = useAttrs();
|
||||
const arrayDataKey =
|
||||
$props.dataKey ?? (useURL.value?.length > 0 ? useURL.value : $attrs.label);
|
||||
|
||||
const arrayData = useArrayData(arrayDataKey, { url: useURL.value });
|
||||
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
||||
|
||||
watch(modelValue, (newValue) => {
|
||||
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
|
||||
|
@ -204,6 +186,7 @@ async function fetchFilter(val) {
|
|||
const where = { ...(val ? defaultWhere : {}), ...$props.where };
|
||||
const fetchOptions = { where, order: sortBy, include, limit };
|
||||
if (fields) fetchOptions.fields = fields;
|
||||
arrayData.store.userParams = $props.params;
|
||||
arrayData.store.userFilter = fetchOptions;
|
||||
arrayData.store.order = fetchOptions.order;
|
||||
arrayData.store.skip = 0;
|
||||
|
@ -258,21 +241,9 @@ async function onScroll({ to, direction, from, index }) {
|
|||
function nullishToTrue(value) {
|
||||
return value ?? true;
|
||||
}
|
||||
|
||||
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- <FetchData
|
||||
ref="dataRef"
|
||||
:url="useURL.value"
|
||||
@on-fetch="(data) => setOptions(data)"
|
||||
:where="where || { [optionValue]: value }"
|
||||
:limit="limit"
|
||||
:sort-by="sortBy"
|
||||
:fields="fields"
|
||||
:params="params"
|
||||
/> -->
|
||||
<QSelect
|
||||
:input-debounce="$attrs.url ? 300 : 0"
|
||||
:loading="isLoading"
|
||||
|
|
Loading…
Reference in New Issue