Fix: 优化代码结构
This commit is contained in:
33
src/config/navigation.ts
Normal file
33
src/config/navigation.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
export interface NavigationItem {
|
||||||
|
title: string
|
||||||
|
to: string
|
||||||
|
icon?: string
|
||||||
|
component?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const navigationConfig: NavigationItem[] = [
|
||||||
|
{
|
||||||
|
title: 'paperTubeWeightCalculate',
|
||||||
|
to: '/calculators/paper-tube-weight',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'beltSpecificationCalculate',
|
||||||
|
to: '/calculators/belt-specification',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'paperRollWeightLengthCalculate',
|
||||||
|
to: '/calculators/paper-roll-weight-length',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'paperTubeProductionCalculate',
|
||||||
|
to: '/calculators/paper-tube-production',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'paperTapeWidthAngleCalculate',
|
||||||
|
to: '/calculators/paper-tape-width-angle',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'multiLayerPaperTapeWidthAngleCalculate',
|
||||||
|
to: '/calculators/multi-layer-paper-tape-width-angle',
|
||||||
|
},
|
||||||
|
]
|
||||||
@ -133,9 +133,11 @@
|
|||||||
class="pa-6"
|
class="pa-6"
|
||||||
fluid
|
fluid
|
||||||
/>
|
/>
|
||||||
<v-fade-transition mode="hide-on-leave">
|
<router-view v-slot="{ Component }">
|
||||||
<router-view />
|
<v-fade-transition hide-on-leave>
|
||||||
</v-fade-transition>
|
<component :is="Component" />
|
||||||
|
</v-fade-transition>
|
||||||
|
</router-view>
|
||||||
</v-main>
|
</v-main>
|
||||||
|
|
||||||
<!-- 页脚 -->
|
<!-- 页脚 -->
|
||||||
@ -156,6 +158,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { navigationConfig } from '@/config/navigation'
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
|
|
||||||
@ -244,32 +247,12 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const menuItems = computed(() => {
|
const menuItems = computed(() => {
|
||||||
return [
|
return navigationConfig.map((item, _) => {
|
||||||
{
|
return {
|
||||||
title: t('paperTubeWeightCalculate'),
|
title: t(item.title),
|
||||||
to: '/calculators/paper-tube-weight',
|
to: item.to,
|
||||||
},
|
}
|
||||||
{
|
})
|
||||||
title: t('beltSpecificationCalculate'),
|
|
||||||
to: '/calculators/belt-specification',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('paperRollWeightLengthCalculate'),
|
|
||||||
to: '/calculators/paper-roll-weight-length',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('paperTubeProductionCalculate'),
|
|
||||||
to: '/calculators/paper-tube-production',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('paperTapeWidthAngleCalculate'),
|
|
||||||
to: '/calculators/paper-tape-width-angle',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('multiLayerPaperTapeWidthAngleCalculate'),
|
|
||||||
to: '/calculators/multi-layer-paper-tape-width-angle',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function toggleLanguage () {
|
function toggleLanguage () {
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
<router-view />
|
<router-view />
|
||||||
</v-main>
|
</v-main>
|
||||||
|
|
||||||
<AppFooter />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|||||||
Reference in New Issue
Block a user