|
@@ -0,0 +1,94 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="router-travel" >
|
|
|
|
|
+ <div class="route-list" >
|
|
|
|
|
+ <div
|
|
|
|
|
+ :class="[
|
|
|
|
|
+ 'route',
|
|
|
|
|
+ useRouterTravel.currentRoute?.path === item.path ? 'active' : ''
|
|
|
|
|
+ ]"
|
|
|
|
|
+ v-for="(item, index) in useRouterTravel.history"
|
|
|
|
|
+ :key="item.path"
|
|
|
|
|
+ @click="onChangeRoute(item)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <span :style="{textAlign: index === 0 ? 'center' : 'right'}" >{{item.name}}</span>
|
|
|
|
|
+ <ReloadIconTsx
|
|
|
|
|
+ :loading="loading"
|
|
|
|
|
+ v-if="useRouterTravel.currentRoute?.path === item.path"
|
|
|
|
|
+ :reload="reloadPage"
|
|
|
|
|
+ />
|
|
|
|
|
+ <CloseOutlined v-if="index != 0" @click="delRouter(item.path)" />
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script setup lang="ts">
|
|
|
|
|
+import { ref } from 'vue'
|
|
|
|
|
+import { useRouterTravelStore } from '@/store'
|
|
|
|
|
+import { ReloadIconTsx } from '@/components/MicroComponents'
|
|
|
|
|
+import { CloseOutlined } from '@ant-design/icons-vue'
|
|
|
|
|
+import { useSchedulerOnce } from '@/hooks'
|
|
|
|
|
+
|
|
|
|
|
+const useRouterTravel = useRouterTravelStore()
|
|
|
|
|
+
|
|
|
|
|
+const loading = ref<boolean>(false)
|
|
|
|
|
+
|
|
|
|
|
+const onChangeRoute = (item) => useRouterTravel.setCurrentRoute(item)
|
|
|
|
|
+
|
|
|
|
|
+const reloadPage = () => {
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ useRouterTravel.keyCount++
|
|
|
|
|
+ useSchedulerOnce(() => {
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ }, 300)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const delRouter = (path: string) => {
|
|
|
|
|
+ console.log('path:', path)
|
|
|
|
|
+ event?.stopPropagation()
|
|
|
|
|
+ useRouterTravel.del(path)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="less" scoped >
|
|
|
|
|
+@import '~@/styles/theme.less';
|
|
|
|
|
+.router-travel {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 52px;
|
|
|
|
|
+ padding-left: 12px;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ border: 1px solid rgba(5, 5, 5, 0.06);
|
|
|
|
|
+ margin-left: -1px;
|
|
|
|
|
+ // box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.2);
|
|
|
|
|
+ .route-list {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ margin-top: 12px;
|
|
|
|
|
+ .route {
|
|
|
|
|
+ min-width: 100px;
|
|
|
|
|
+ height: 40px;
|
|
|
|
|
+ line-height: 40px;
|
|
|
|
|
+ // text-align: right;
|
|
|
|
|
+ border-radius: 8px 8px 0px 0px;
|
|
|
|
|
+ border: 1px solid rgba(5, 5, 5, 0.06);
|
|
|
|
|
+ background: rgba(0, 0, 0, 0.02);
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ margin-right: 2px;
|
|
|
|
|
+ padding: 0 8px;
|
|
|
|
|
+ transition: all 0.2s;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .active {
|
|
|
|
|
+ color: @primary-color;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+</style>
|