mirror of
https://github.com/muerwre/muerwre.github.io.git
synced 2025-04-25 19:06:41 +07:00
initial
This commit is contained in:
commit
5104c2518b
34 changed files with 6844 additions and 0 deletions
35
components/content/ProseA.vue
Normal file
35
components/content/ProseA.vue
Normal file
|
@ -0,0 +1,35 @@
|
|||
<script lang="ts" setup>
|
||||
interface Props {
|
||||
href?: string;
|
||||
blank?: boolean;
|
||||
}
|
||||
|
||||
withDefaults(defineProps<Props>(), {
|
||||
href: "",
|
||||
blank: false,
|
||||
});
|
||||
|
||||
const isInternalLink = (link: string) => !link.match(/^\w+\:\/\//);
|
||||
|
||||
const transformInternalLinks = (href: string) => {
|
||||
if (!isInternalLink(href)) {
|
||||
return href;
|
||||
}
|
||||
|
||||
return href
|
||||
.toLowerCase()
|
||||
.replaceAll("%20", " ")
|
||||
.replace(/\d+/g, "")
|
||||
.trim()
|
||||
.replaceAll(" ", "-");
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLink
|
||||
:href="transformInternalLinks(href)"
|
||||
:target="isInternalLink(href) ? '' : '_blank'"
|
||||
>
|
||||
<slot
|
||||
/></NuxtLink>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue