mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	perf: perf sidebar (#91)
This commit is contained in:
		
							parent
							
								
									0615902632
								
							
						
					
					
						commit
						c25b130b7d
					
				@ -3,11 +3,13 @@ import path from "path";
 | 
				
			|||||||
import { storageLocal } from "/@/utils/storage";
 | 
					import { storageLocal } from "/@/utils/storage";
 | 
				
			||||||
import { PropType, ref, nextTick } from "vue";
 | 
					import { PropType, ref, nextTick } from "vue";
 | 
				
			||||||
import { childrenType } from "../../types";
 | 
					import { childrenType } from "../../types";
 | 
				
			||||||
 | 
					import { useAppStoreHook } from "/@/store/modules/app";
 | 
				
			||||||
import Icon from "/@/components/ReIcon/src/Icon.vue";
 | 
					import Icon from "/@/components/ReIcon/src/Icon.vue";
 | 
				
			||||||
const layout = ref(
 | 
					const layout = ref(
 | 
				
			||||||
  storageLocal.getItem("responsive-layout") || "vertical-dark"
 | 
					  storageLocal.getItem("responsive-layout") || "vertical-dark"
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
const menuMode = layout.value.layout.split("-")[0] === "vertical";
 | 
					const menuMode = layout.value.layout.split("-")[0] === "vertical";
 | 
				
			||||||
 | 
					const pureApp = useAppStoreHook();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const props = defineProps({
 | 
					const props = defineProps({
 | 
				
			||||||
  item: {
 | 
					  item: {
 | 
				
			||||||
@ -91,7 +93,15 @@ function resolvePath(routePath) {
 | 
				
			|||||||
        "
 | 
					        "
 | 
				
			||||||
      />
 | 
					      />
 | 
				
			||||||
      <template #title>
 | 
					      <template #title>
 | 
				
			||||||
        <div style="display: flex; align-items: center; overflow: hidden">
 | 
					        <div
 | 
				
			||||||
 | 
					          style="
 | 
				
			||||||
 | 
					            width: 100%;
 | 
				
			||||||
 | 
					            display: flex;
 | 
				
			||||||
 | 
					            align-items: center;
 | 
				
			||||||
 | 
					            justify-content: space-between;
 | 
				
			||||||
 | 
					            overflow: hidden;
 | 
				
			||||||
 | 
					          "
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
          <span v-if="!menuMode">{{ $t(onlyOneChild.meta.title) }}</span>
 | 
					          <span v-if="!menuMode">{{ $t(onlyOneChild.meta.title) }}</span>
 | 
				
			||||||
          <el-tooltip
 | 
					          <el-tooltip
 | 
				
			||||||
            v-else
 | 
					            v-else
 | 
				
			||||||
@ -103,6 +113,7 @@ function resolvePath(routePath) {
 | 
				
			|||||||
            <span
 | 
					            <span
 | 
				
			||||||
              ref="menuTextRef"
 | 
					              ref="menuTextRef"
 | 
				
			||||||
              style="overflow: hidden; text-overflow: ellipsis"
 | 
					              style="overflow: hidden; text-overflow: ellipsis"
 | 
				
			||||||
 | 
					              :style="pureApp.sidebar.opened ? 'width: 125px' : ''"
 | 
				
			||||||
              @mouseover="hoverMenu(onlyOneChild)"
 | 
					              @mouseover="hoverMenu(onlyOneChild)"
 | 
				
			||||||
            >
 | 
					            >
 | 
				
			||||||
              {{ $t(onlyOneChild.meta.title) }}
 | 
					              {{ $t(onlyOneChild.meta.title) }}
 | 
				
			||||||
@ -132,7 +143,7 @@ function resolvePath(routePath) {
 | 
				
			|||||||
        v-else
 | 
					        v-else
 | 
				
			||||||
        placement="top"
 | 
					        placement="top"
 | 
				
			||||||
        :offset="-10"
 | 
					        :offset="-10"
 | 
				
			||||||
        :disabled="!props.item.showTooltip"
 | 
					        :disabled="!pureApp.sidebar.opened || !props.item.showTooltip"
 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
        <template #content> {{ $t(props.item.meta.title) }} </template>
 | 
					        <template #content> {{ $t(props.item.meta.title) }} </template>
 | 
				
			||||||
        <div
 | 
					        <div
 | 
				
			||||||
 | 
				
			|||||||
@ -129,6 +129,7 @@
 | 
				
			|||||||
    .el-menu-item,
 | 
					    .el-menu-item,
 | 
				
			||||||
    .el-sub-menu__title {
 | 
					    .el-sub-menu__title {
 | 
				
			||||||
      color: $menuText;
 | 
					      color: $menuText;
 | 
				
			||||||
 | 
					      padding: 0 16px 0 40px;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // menu hover
 | 
					    // menu hover
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user