forked from verdnatura/salix-front
refs #6704: fix1
This commit is contained in:
parent
6304776fac
commit
972c340fad
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue