diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index a55bde6f2..74c4a9bc0 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -98,19 +98,17 @@ defineExpose({ }); async function fetch(data) { - if (data && Array.isArray(data)) { - let $index = 0; - data.map((d) => (d.$index = $index++)); - } - resetData(data); - emit('onFetch', data); return data; } function resetData(data) { if (!data) return; + if (data && Array.isArray(data)) { + let $index = 0; + data.map((d) => (d.$index = $index++)); + } originalData.value = JSON.parse(JSON.stringify(data)); formData.value = JSON.parse(JSON.stringify(data)); @@ -299,7 +297,7 @@ watch(formUrl, async () => { :url="url" :limit="limit" @on-fetch="fetch" - @on-change="resetData" + @on-change="fetch" :skeleton="false" ref="vnPaginateRef" v-bind="$attrs"