diff --git a/package-lock.json b/package-lock.json index 2946032..2208166 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "erp-vue3", + "name": "vue3-element-admin", "version": "1.0.0", "lockfileVersion": 1, "requires": true, @@ -2796,6 +2796,12 @@ "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.5.tgz", "integrity": "sha512-AQq+pllb6FCc7rS6vh4PPcce3XA1jgK3hKNkQ4hXHwoVN7jOeAOMKCnX7XAX3etV9rmN7iNW8iIwgPk95ckBjw==" }, + "vue3-pro-table": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/vue3-pro-table/-/vue3-pro-table-1.0.0.tgz", + "integrity": "sha512-tJXFLhkzUJUvGle04poYEt5HEUtAcNXyeQCFlcxwZUooPgZc49sqDGk37xXmEEqKWXtFgMqA4p1F9x3BfgW3jg==", + "dev": true + }, "vuex": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.0.tgz", diff --git a/package.json b/package.json index 717d397..ff088f4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "erp-vue3", + "name": "vue3-element-admin", "version": "1.0.0", "author": { "name": "huzhushan", @@ -32,15 +32,16 @@ "sass": "^1.32.8", "vite": "^2.1.0", "vite-plugin-mock": "^2.3.0", - "vite-plugin-svg-icons": "^0.4.0" + "vite-plugin-svg-icons": "^0.4.0", + "vue3-pro-table": "^1.0.0" }, "repository": { "type": "git", - "url": "git+https://github.com/huzhushan/erp-vue3.git" + "url": "git+https://github.com/huzhushan/vue3-element-admin.git" }, "license": "MIT", "bugs": { - "url": "https://github.com/huzhushan/erp-vue3/issues" + "url": "https://github.com/huzhushan/vue3-element-admin/issues" }, - "homepage": "https://github.com/huzhushan/erp-vue3" + "homepage": "https://github.com/huzhushan/vue3-element-admin" } diff --git a/readme.md b/readme.md index 233f114..2bc329b 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,3 @@ # 简介 -vue3-element-admin 是一个后台管理系统前端解决方案,它基于 vue3 和 element-plus 实现 +vue3-element-admin 是一个后台管理系统前端解决方案,它基于 vue3 + element-plus + vite 实现 diff --git a/src/layout/components/Tagsbar/hooks/useContextMenu.js b/src/layout/components/Tagsbar/hooks/useContextMenu.js index 6ee3d72..70045b3 100644 --- a/src/layout/components/Tagsbar/hooks/useContextMenu.js +++ b/src/layout/components/Tagsbar/hooks/useContextMenu.js @@ -46,6 +46,27 @@ export const useContextMenu = (tagList) => { store.dispatch("tags/delOtherTags", state.selectedTag) router.push(state.selectedTag); }, + closeLeftTags () { + state.closeSomeTags('left') + + }, + closeRightTags () { + state.closeSomeTags('right') + + }, + closeSomeTags (direction) { + const index = tagList.value.findIndex( + (item) => item.fullPath === state.selectedTag.fullPath + ); + + if ((direction === 'left' && index <= 0) || (direction === 'right' && index >= tagList.value.length - 1)) { + return; + } + + const needToClose = direction === 'left' ? tagList.value.slice(0, index) : tagList.value.slice(index + 1) + store.dispatch("tags/delSomeTags", needToClose) + router.push(state.selectedTag); + }, closeAllTags () { store.dispatch("tags/delAllTags") router.push("/"); diff --git a/src/layout/components/Tagsbar/hooks/useTags.js b/src/layout/components/Tagsbar/hooks/useTags.js index 455eef7..10bdc96 100644 --- a/src/layout/components/Tagsbar/hooks/useTags.js +++ b/src/layout/components/Tagsbar/hooks/useTags.js @@ -1,5 +1,5 @@ import { useScrollbar } from "./useScrollbar"; -import { onMounted, watch, computed, ref, nextTick } from 'vue'; +import { watch, computed, ref, nextTick, onBeforeMount } from 'vue'; import { useRouter } from 'vue-router'; import { useStore } from 'vuex' @@ -73,7 +73,7 @@ export const useTags = () => { - onMounted(() => { + onBeforeMount(() => { initTags(); addTag(); moveToCurrentTag(); diff --git a/src/layout/components/Tagsbar/index.vue b/src/layout/components/Tagsbar/index.vue index d48ee4c..ca49516 100644 --- a/src/layout/components/Tagsbar/index.vue +++ b/src/layout/components/Tagsbar/index.vue @@ -39,6 +39,8 @@