refs #6694 VnLocation #154
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
import { deepFind } from 'src/composables/deepFind';
|
||||
import { ref, toRefs, computed, watch } from 'vue';
|
||||
const emit = defineEmits(['update:modelValue', 'update:options']);
|
||||
|
||||
|
@ -51,20 +52,7 @@ function setOptions(data) {
|
|||
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||
}
|
||||
function deepFind(obj, path) {
|
||||
var paths = path.split('.')
|
||||
, current = obj
|
||||
, i;
|
||||
|
||||
for (i = 0; i < paths.length; ++i) {
|
||||
if (current[paths[i]] == undefined) {
|
||||
return undefined;
|
||||
} else {
|
||||
current = current[paths[i]];
|
||||
}
|
||||
}
|
||||
return current;
|
||||
}
|
||||
setOptions(options.value);
|
||||
const filter = (val, options) => {
|
||||
const search = val.toString().toLowerCase();
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
export async function deepFind(obj, path) {
|
||||
jsegarra marked this conversation as resolved
Outdated
|
||||
const keys = path.split('.');
|
||||
let current = obj;
|
||||
|
||||
for (const key of keys) {
|
||||
if (current[key] !== undefined) {
|
||||
current = current[key];
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
Loading…
Reference in New Issue
Un includes no funcionaria igual?
No te sigo, pero lo comentamos si quieres sobre un ejemplo
He revisado el codigo y no llego a ver cuando se usa eso ni tampoco veo el porque.
De hecho solo llegaria a usar en CustomerBasicData y tampoco pq se deberia quitar el filtro que tiene
Un ejemplo sería si quieres buscar por nombre de un pueblo en la petición de postocde, porque la estructura que devuelve postocde es
[
{ id: 1, town:{ id:1, name:'Algemesi'}}
]
Es verdad que esto se hizo para filtrar la carga inicial, pero con el número de resultados que manejamos, se descartó y por tanto este código también se debería.
Lo quito
Corregido
5d888a2977