8627-devToTest #1421
|
@ -38,23 +38,17 @@ onBeforeMount(async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props.baseUrl) {
|
onBeforeRouteUpdate(async (to, from) => {
|
||||||
onBeforeRouteUpdate(async (to, from) => {
|
const id = to.params.id;
|
||||||
if (hasRouteParam(to.params)) {
|
if (id !== from.params.id) await fetch(id, true);
|
||||||
const { matched } = router.currentRoute.value;
|
});
|
||||||
const { name } = matched.at(-3);
|
|
||||||
if (name) {
|
async function fetch(id, append = false) {
|
||||||
router.push({ name, params: to.params });
|
const regex = /\/(\d+)/;
|
||||||
}
|
if (props.idInWhere) arrayData.store.filter.where = { id };
|
||||||
}
|
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
|
||||||
if (to.params.id !== from.params.id) {
|
else arrayData.store.url = props.url.replace(regex, `/${id}`);
|
||||||
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
await arrayData.fetch({ append, updateRouter: false });
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function hasRouteParam(params, valueToCheck = ':addressId') {
|
|
||||||
return Object.values(params).includes(valueToCheck);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Reference in New Issue