Better navigator

This commit is contained in:
LittleSheep 2024-03-11 23:50:36 +08:00
parent 7f89b36efd
commit 73aaa6af56
2 changed files with 12 additions and 28 deletions

View File

@ -1,31 +1,23 @@
<template>
<div>
<component
:is="props.brief ? RouterLink : 'div'"
:to="{ name: 'posts.details.articles', params: { alias: props.item?.alias } }"
>
<section v-if="!props.contentOnly" class="mb-2">
<h1 class="text-lg font-bold">{{ props.item?.title }}</h1>
<div class="text-sm">{{ props.item?.description }}</div>
</section>
<div v-if="props.brief" class="mt-2">
<v-btn
append-icon="mdi-arrow-right"
variant="tonal"
size="small"
rounded="sm"
:to="{ name: 'posts.details.articles', params: { alias: props.item?.alias ?? 'not-found' } }"
>
Read more
</v-btn>
</div>
<div v-else>
<article class="prose max-w-none" v-html="parseContent(props.item?.content ?? '')" />
</div>
</div>
</component>
</template>
<script setup lang="ts">
import dompurify from "dompurify"
import { parse } from "marked"
import { RouterLink } from "vue-router"
const props = defineProps<{ item: any; brief?: boolean; contentOnly?: boolean }>()

View File

@ -1,24 +1,16 @@
<template>
<div>
<component
:is="props.brief ? RouterLink : 'div'"
:to="{ name: 'posts.details.moments', params: { alias: props.item?.alias } }"
>
<article class="prose prose-moment" v-html="parseContent(props.item?.content ?? '')" />
<div v-if="props.brief" class="my-1">
<v-btn
append-icon="mdi-arrow-right"
variant="tonal"
size="x-small"
rounded="sm"
:to="{ name: 'posts.details.moments', params: { alias: props.item?.alias ?? 'not-found' } }"
>
More
</v-btn>
</div>
</div>
</component>
</template>
<script setup lang="ts">
import dompurify from "dompurify"
import { parse } from "marked"
import { RouterLink } from "vue-router"
const props = defineProps<{ item: any; brief?: boolean }>()