Commit 4bbdc1e87bc4df9e7d41b50388364155720c8723
1 parent
3b871284
修复TagsView组件中,鼠标滚轮按下的时候,可以关闭不可关闭的tag
Showing
3 changed files
with
12 additions
and
4 deletions
ruoyi-ui/src/assets/styles/element-ui.scss
ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue
| 1 | 1 | <template> |
| 2 | - <div v-if="!item.hidden" class="menu-wrapper"> | |
| 2 | + <div v-if="!item.hidden"> | |
| 3 | 3 | <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow"> |
| 4 | 4 | <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)"> |
| 5 | 5 | <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}"> | ... | ... |
ruoyi-ui/src/layout/components/TagsView/index.vue
| ... | ... | @@ -9,16 +9,16 @@ |
| 9 | 9 | :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" |
| 10 | 10 | tag="span" |
| 11 | 11 | class="tags-view-item" |
| 12 | - @click.middle.native="closeSelectedTag(tag)" | |
| 12 | + @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''" | |
| 13 | 13 | @contextmenu.prevent.native="openMenu(tag,$event)" |
| 14 | 14 | > |
| 15 | 15 | {{ tag.title }} |
| 16 | - <span v-if="!tag.meta.affix" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" /> | |
| 16 | + <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" /> | |
| 17 | 17 | </router-link> |
| 18 | 18 | </scroll-pane> |
| 19 | 19 | <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu"> |
| 20 | 20 | <li @click="refreshSelectedTag(selectedTag)">刷新页面</li> |
| 21 | - <li v-if="!(selectedTag.meta&&selectedTag.meta.affix)" @click="closeSelectedTag(selectedTag)">关闭当前</li> | |
| 21 | + <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li> | |
| 22 | 22 | <li @click="closeOthersTags">关闭其他</li> |
| 23 | 23 | <li @click="closeAllTags(selectedTag)">关闭所有</li> |
| 24 | 24 | </ul> |
| ... | ... | @@ -69,6 +69,9 @@ export default { |
| 69 | 69 | isActive(route) { |
| 70 | 70 | return route.path === this.$route.path |
| 71 | 71 | }, |
| 72 | + isAffix(tag) { | |
| 73 | + return tag.meta && tag.meta.affix | |
| 74 | + }, | |
| 72 | 75 | filterAffixTags(routes, basePath = '/') { |
| 73 | 76 | let tags = [] |
| 74 | 77 | routes.forEach(route => { | ... | ... |