forked from verdnatura/salix-front
handle searchbar dataKey change
This commit is contained in:
parent
b26bf10e70
commit
990e3f6e75
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue