refactor: 将各个页面的面包屑导航提取为单独组件AppBreadcrumb
This commit is contained in:
@ -3,21 +3,7 @@
|
||||
<div v-if="!pending">
|
||||
<div v-if="solution">
|
||||
<div class="page-header">
|
||||
<el-breadcrumb class="breadcrumb" separator="/">
|
||||
<el-breadcrumb-item class="text-md opacity-50">
|
||||
<NuxtLink :to="$localePath('/')">{{
|
||||
$t('navigation.home')
|
||||
}}</NuxtLink>
|
||||
</el-breadcrumb-item>
|
||||
<el-breadcrumb-item class="text-md opacity-50">
|
||||
<NuxtLink :to="$localePath('/solutions')">{{
|
||||
$t('navigation.solutions')
|
||||
}}</NuxtLink>
|
||||
</el-breadcrumb-item>
|
||||
<el-breadcrumb-item class="text-md opacity-50">{{
|
||||
solution.title
|
||||
}}</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
|
||||
</div>
|
||||
<div class="page-content">
|
||||
<div class="solution-info">
|
||||
@ -42,7 +28,10 @@
|
||||
:sub-title="$t('solution-not-found-desc')"
|
||||
>
|
||||
<template #extra>
|
||||
<el-button type="primary" @click="$router.push('/solutions')">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="$router.push($localePath('/solutions'))"
|
||||
>
|
||||
{{ $t('back-to-solutions') }}
|
||||
</el-button>
|
||||
</template>
|
||||
@ -57,17 +46,25 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
const route = useRoute();
|
||||
const localePath = useLocalePath();
|
||||
|
||||
// 获取路由参数(documentId)
|
||||
const id = computed(() => route.params.slug as string);
|
||||
|
||||
const { data, pending, error } = await useSolution(id.value);
|
||||
|
||||
console.log('RawData: ', data.value);
|
||||
const process = toSolutionView(data.value);
|
||||
console.log('Processed Solution: ', process);
|
||||
const solution = computed(() => {
|
||||
if (!data.value) {
|
||||
return null;
|
||||
}
|
||||
return toSolutionView(data.value);
|
||||
});
|
||||
|
||||
const solution = computed(() => toSolutionView(data.value));
|
||||
const breadcrumbItems = computed(() => [
|
||||
{ label: $t('navigation.home'), to: localePath('/') },
|
||||
{ label: $t('navigation.solutions'), to: localePath('/solutions') },
|
||||
{ label: solution.value ? solution.value.title : '' },
|
||||
]);
|
||||
|
||||
watch(error, (value) => {
|
||||
if (value) {
|
||||
|
||||
Reference in New Issue
Block a user