Skip to content

Commit

Permalink
chore(site): add reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Jul 20, 2023
1 parent 2341a2a commit 0b0471d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/sites/assets/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ const isJDDKH = () => {
return window.parent.location.href.includes('jddkh');
};
export { isMobile, isJDT, isJDB, isJDDKH };

export const reorder = (packages: Array<any>) => {
return packages.sort(function (x: any, y: any) {
return x['name'].localeCompare(y['name']);
});
};
7 changes: 6 additions & 1 deletion src/sites/doc/components/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<ol v-for="_nav in nav" :key="_nav">
<li>{{ _nav.name }}</li>
<ul>
<template :class="{ active: isActive(_package.name) }" v-for="_package in _nav.packages" :key="_package">
<template
:class="{ active: isActive(_package.name) }"
v-for="_package in reorder(_nav.packages)"
:key="_package"
>
<li v-if="_package.show">
<router-link :to="_package.name.toLowerCase()" :class="{ active: isActive(_package.name) }">
{{ _package.name }}&nbsp;&nbsp;<b>{{ _package.cName }}</b>
Expand All @@ -18,6 +22,7 @@
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { RefData } from '@/sites/assets/util/ref';
import { nav } from '@/config.json';
import { reorder } from '../../assets/util/index';
const fixed = ref(false);
const isActive = computed(() => {
return function (name: string) {
Expand Down
3 changes: 2 additions & 1 deletion src/sites/mobile/components/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ol v-for="_nav in nav" :key="_nav.name">
<li>{{ _nav.name }}</li>
<ul>
<template v-for="_package in _nav.packages" :key="_package">
<template v-for="_package in reorder(_nav.packages)" :key="_package">
<li v-if="_package.show">
<router-link :to="`/zh-CN/${_package.name.toLowerCase()}`"
>{{ _package.name }}&nbsp;&nbsp;{{ _package.cName }}
Expand All @@ -28,6 +28,7 @@
<script setup lang="ts">
import { nav } from '@/config.json';
import { Right } from '@nutui/icons-vue';
import { reorder } from '../../assets/util';
const info = {
logo: 'https://img14.360buyimg.com/imagetools/jfs/t1/167902/2/8762/791358/603742d7E9b4275e3/e09d8f9a8bf4c0ef.png',
title: 'NutUI',
Expand Down

0 comments on commit 0b0471d

Please sign in to comment.