diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue
index 8517525df..c81bcd8e2 100644
--- a/src/components/common/VnCard.vue
+++ b/src/components/common/VnCard.vue
@@ -1,6 +1,6 @@
$props.dataKey === route.meta.moduleName);
defineExpose({ getData });
onBeforeMount(async () => {
@@ -58,10 +58,12 @@ onBeforeMount(async () => {
store = arrayData.store;
entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
// It enables to load data only once if the module is the same as the dataKey
- if ($props.dataKey !== route.meta.moduleName || !route.params.id) await getData();
+ if (!isSameDataKey.value || !route.params.id) await getData();
watch(
() => [$props.url, $props.filter],
- async () => await getData()
+ async () => {
+ if (!isSameDataKey.value) await getData();
+ }
);
});
@@ -77,14 +79,50 @@ async function getData() {
isLoading.value = false;
}
}
+
+function getValueFromPath(path) {
+ if (!path) return;
+ const keys = path.toString().split('.');
+ let current = entity.value;
+
+ for (let i = 0; i < keys.length; i++) {
+ if (current[keys[i]] === undefined) return undefined;
+ else current = current[keys[i]];
+ }
+ return current;
+}
+
const emit = defineEmits(['onFetch']);
+
+const iconModule = computed(() => route.matched[1].meta.icon);
+const toModule = computed(() =>
+ route.matched[1].path.split('/').length > 2
+ ? route.matched[1].redirect
+ : route.matched[1].children[0].redirect
+);