Use enum to identify routes.
This commit is contained in:
parent
68f893aa91
commit
4db53af7ce
5 changed files with 47 additions and 34 deletions
|
|
@ -1,29 +1,25 @@
|
|||
<script setup lang="ts">
|
||||
import {computed, defineProps} from "vue";
|
||||
import type {ComponentVariant, NodesFilter} from "@/types";
|
||||
import type {RouteName} from "@/router";
|
||||
import router, {route} from "@/router";
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
icon: string;
|
||||
variant: ComponentVariant;
|
||||
value: number;
|
||||
link: string;
|
||||
route: RouteName;
|
||||
filter?: NodesFilter;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const linkTarget = computed(() => {
|
||||
if (props.filter) {
|
||||
return {
|
||||
path: props.link,
|
||||
query: {
|
||||
filter: JSON.stringify(props.filter),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
return props.link;
|
||||
}
|
||||
const query = props.filter && {
|
||||
filter: JSON.stringify(props.filter),
|
||||
};
|
||||
return route(props.route, query);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue