feat: setup unplugin-vue-router, fixed eslnt config, SmartLink for type-safe internal/external links
This commit is contained in:
parent
3c0e46c9ab
commit
60ce6d75f7
15 changed files with 435 additions and 311 deletions
18
apps/vdn-static/src/components/organisms/SmartLink.vue
Normal file
18
apps/vdn-static/src/components/organisms/SmartLink.vue
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import type { RouterLinkProps } from "vue-router";
|
||||
import type { RouteNamedMap } from "vue-router/auto-routes";
|
||||
|
||||
defineProps<
|
||||
Omit<RouterLinkProps, "to">
|
||||
& (
|
||||
| { internal: true; to: keyof RouteNamedMap }
|
||||
| { external: true; to: `https://${string}` | `http://${string}` }
|
||||
)
|
||||
>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouterLink v-bind="$props">
|
||||
<slot />
|
||||
</RouterLink>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue