0
0
Fork 0

handle searchbar dataKey change

This commit is contained in:
William Buezas 2024-05-21 09:13:36 -03:00
parent b26bf10e70
commit 990e3f6e75
1 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref } from 'vue'; import { onMounted, ref, watch } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
@ -67,11 +67,19 @@ const props = defineProps({
}, },
}); });
const arrayData = useArrayData(props.dataKey, { ...props }); let arrayData = useArrayData(props.dataKey, { ...props });
const { store } = arrayData; let store = arrayData.store;
const searchText = ref(''); const searchText = ref('');
const { navigate } = useRedirect(); const { navigate } = useRedirect();
watch(
() => props.dataKey,
(val) => {
arrayData = useArrayData(val, { ...props });
store = arrayData.store;
}
);
onMounted(() => { onMounted(() => {
const params = store.userParams; const params = store.userParams;
if (params && params.search) { if (params && params.search) {