Skip to content

Commit

Permalink
Merge branch 'main' into wc-main
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Oct 20, 2021
2 parents cc1be1c + 6372010 commit a85a91e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ git merge upstream/main

<img src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/d41b5fec542444b4a28c00135ce27d42~tplv-k3u1fbpfcp-watermark.image" width="180px" />

<img src="https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/18876e84d4724f688f931f76f059f522~tplv-k3u1fbpfcp-watermark.image?" width="180px" />
<img src="https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/6133230c9a6d49fdb0cd3e5197564da2~tplv-k3u1fbpfcp-watermark.image??" width="180px" />

## 赞助 | Sponsored

Expand Down
38 changes: 20 additions & 18 deletions src/layout/components/AppMain.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
<template>
<section class="app-main">
<el-tabs
id="Tabs"
<el-tabs id="Tabs"
v-model="currentIndex"
type="card"
closable
@tab-click="clickTab"
@tab-remove="removeTab"
>
@tab-remove="removeTab">
<el-tab-pane
v-for="item in tabsOption"
:key="item.route"
:closable="item.route !== '/home'"
:label="item.title[lang]"
:name="item.route"
></el-tab-pane>
:name="item.route" />
</el-tabs>
<router-view v-if="$route.meta.keepAlive" v-slot="{ Component }">
<transition name="fade" mode="out-in">
<component :is="Component" :key="$route.path" />
</transition>
</router-view>

<router-view v-if="$route.meta.keepAlive" v-slot="{ Component }">
<transition name="fade" mode="out-in">
<router-view v-if="$route.meta.keepAlive" v-slot="{ Component }">
<transition name="fade" mode="out-in">
<component :is="Component" :key="$route.path" />
</transition>
</router-view>
<router-view v-else v-slot="{ Component }">
<transition name="fade" mode="out-in">
<keep-alive>
<component :is="Component" :key="$route.path" />
</transition>
</router-view>
<router-view v-else v-slot="{ Component }">
<transition name="fade" mode="out-in">
<keep-alive>
<component :is="Component" :key="$route.path" />
</keep-alive>
</transition>
</router-view>
</el-tabs>
</keep-alive>
</transition>
</router-view>
</section>
</template>
<script lang="ts">
Expand Down
19 changes: 15 additions & 4 deletions src/layout/components/Sidebar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
</div>
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue'
import { useRouter } from 'vue-router'
import {
computed,
defineComponent,
onMounted,
} from 'vue'
import { useRoute } from 'vue-router'
import { isExternal } from '@/utils/validate'
import sidebarItem from '@/layout/components/Sidebar/sidebarItem.vue'
import logo from './Logo.vue'
Expand All @@ -30,13 +34,20 @@ export default defineComponent({
sidebarItem
},
setup() {
const router = useRouter()
const route = useRoute()
const store = useStore()
const isCollapse = computed(() => !store.getters['appModule/getSidebarState'])
const showLogo = computed(() => store.state.settingsModule.sideBarLogo)
const routes = computed(() => store.state.permissionModule.accessRoutes)
const activeMenu = computed(() => router.currentRoute.value.fullPath)
const activeMenu = computed(() => store.getters['tabModule/getCurrentIndex'])
onMounted(() => {
const routePath = route.path
store.commit('tabModule/SET_TAB',routePath)
})
// methods
// eslint-disable-next-line consistent-return
const resolvePath = (routePath: string) => {
Expand Down
9 changes: 4 additions & 5 deletions src/layout/components/Sidebar/sidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<div v-if="!item.meta.hidden" class="menu-wrapper">
<!--only on child show el-menu -->
<template v-if="hasOneShowingChild(item.children, item)">
<el-menu-item :key="item.path" :index="item.path" :route="item.path">
<i :class="item.meta.icon"></i>
<template #title>{{ item.meta.title[lang] }}</template>
<el-menu-item :key="onlyOneChild.path" :index="onlyOneChild.path" :route="onlyOneChild.path">
<i :class="onlyOneChild.meta.icon"></i>
<template #title>{{ onlyOneChild.meta.title[lang] }}</template>
</el-menu-item>
</template>
<el-sub-menu v-else ref="subMenu" :index="item.path" popper-append-to-body>
<template #title>
<i :class="item.meta.icon"></i>
<i :data-index='item.path' :class="item.meta.icon"></i>
<span>{{ item.meta.title[lang] }}</span>
</template>
<!--children 进行递归调用自身组件-->
Expand Down Expand Up @@ -96,7 +96,6 @@ export default defineComponent({
onlyOneChild.value = { ...parent, noShowingChildren: true }
return true
}
// }
return false
}
Expand Down
4 changes: 2 additions & 2 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export const asyncRoutes:Array<RouteRecordRaw> = [
'/zh-CN': '复制文本',
'/en-US': 'Copy Text'
},
icon: 'home',
icon: 'el-icon-edit-outline',
},
},
],
Expand Down Expand Up @@ -605,7 +605,7 @@ export const asyncRoutes:Array<RouteRecordRaw> = [
'/zh-CN': '文件上传',
'/en-US': 'File Upload'
},
icon: 'home',
icon: 'el-icon-upload',
},
},
],
Expand Down

0 comments on commit a85a91e

Please sign in to comment.