0
0
Fork 0
This commit is contained in:
Javier Segarra 2024-01-15 14:44:38 +01:00
parent 6304776fac
commit 972c340fad
1 changed files with 17 additions and 2 deletions

View File

@ -1,10 +1,12 @@
<script setup>
import { onMounted, ref, watch } from 'vue';
import { onMounted, ref, watch, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData';
import { useRoute } from 'vue-router';
const { t } = useI18n();
const route = useRoute();
const props = defineProps({
dataKey: {
type: String,
@ -79,14 +81,27 @@ const store = arrayData.store;
onMounted(() => {
if (props.autoLoad) fetch();
});
onUnmounted(async ()=>{
arrayData.destroy()
});
watch(
() => props.data,
() => {
// store.skip = 0;
store.data = props.data;
}
);
// watch(
// () => route.path,
// async (newId, oldId) => {
// if (newId!==oldId) {
// // arrayData.hasMoreData.value = [];
// arrayData.store.clear()
// }
// }
// );
async function fetch() {
await arrayData.fetch({ append: false });
if (!arrayData.hasMoreData.value) {