fix(CrudModel): onChange $index
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2024-07-12 14:02:29 +02:00
parent 904acfd48f
commit 3087dbf512
1 changed files with 5 additions and 7 deletions

View File

@ -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"