1 line
24 KiB
JSON
1 line
24 KiB
JSON
{"remainingRequest":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\babel-loader\\lib\\index.js!D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\layout\\components\\TagsView\\index.vue?vue&type=script&lang=js","dependencies":[{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\layout\\components\\TagsView\\index.vue","mtime":1718070786027},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\babel.config.js","mtime":1718070785981},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1718764957200},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\babel-loader\\lib\\index.js","mtime":1718764959024},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1718764957200},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\vue-loader\\lib\\index.js","mtime":1718764959862}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:aW1wb3J0IF9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyIGZyb20gIkQ6L3BocHN0dWR5X3Byby9XV1cvdHJhdmVsL2FkbWluL25vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZXJzL2VzbS9jcmVhdGVGb3JPZkl0ZXJhdG9ySGVscGVyLmpzIjsKaW1wb3J0IF90b0NvbnN1bWFibGVBcnJheSBmcm9tICJEOi9waHBzdHVkeV9wcm8vV1dXL3RyYXZlbC9hZG1pbi9ub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9lc20vdG9Db25zdW1hYmxlQXJyYXkuanMiOwppbXBvcnQgX29iamVj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Sk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHRoaXMuJHJvdXRlci5wdXNoKCcvJyk7CiAgICAgICAgfQogICAgICB9CiAgICB9LAogICAgb3Blbk1lbnU6IGZ1bmN0aW9uIG9wZW5NZW51KHRhZywgZSkgewogICAgICB2YXIgbWVudU1pbldpZHRoID0gMTA1OwogICAgICB2YXIgb2Zmc2V0TGVmdCA9IHRoaXMuJGVsLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmxlZnQ7IC8vIGNvbnRhaW5lciBtYXJnaW4gbGVmdAogICAgICB2YXIgb2Zmc2V0V2lkdGggPSB0aGlzLiRlbC5vZmZzZXRXaWR0aDsgLy8gY29udGFpbmVyIHdpZHRoCiAgICAgIHZhciBtYXhMZWZ0ID0gb2Zmc2V0V2lkdGggLSBtZW51TWluV2lkdGg7IC8vIGxlZnQgYm91bmRhcnkKICAgICAgdmFyIGxlZnQgPSBlLmNsaWVudFggLSBvZmZzZXRMZWZ0ICsgMTU7IC8vIDE1OiBtYXJnaW4gcmlnaHQKCiAgICAgIGlmIChsZWZ0ID4gbWF4TGVmdCkgewogICAgICAgIHRoaXMubGVmdCA9IG1heExlZnQ7CiAgICAgIH0gZWxzZSB7CiAgICAgICAgdGhpcy5sZWZ0ID0gbGVmdDsKICAgICAgfQogICAgICB0aGlzLnRvcCA9IGUuY2xpZW50WTsKICAgICAgdGhpcy52aXNpYmxlID0gdHJ1ZTsKICAgICAgdGhpcy5zZWxlY3RlZFRhZyA9IHRhZzsKICAgIH0sCiAgICBjbG9zZU1lbnU6IGZ1bmN0aW9uIGNsb3NlTWVudSgpIHsKICAgICAgdGhpcy52aXNpYmxlID0gZmFsc2U7CiAgICB9LAogICAgaGFuZGxlU2Nyb2xsOiBmdW5jdGlvbiBoYW5kbGVTY3JvbGwoKSB7CiAgICAgIHRoaXMuY2xvc2VNZW51KCk7CiAgICB9CiAgfQp9Ow=="},{"version":3,"names":["ScrollPane","path","components","data","visible","top","left","selectedTag","affixTags","computed","visitedViews","$store","state","tagsView","routes","permission","watch","$route","addTags","moveToCurrentTag","value","document","body","addEventListener","closeMenu","removeEventListener","mounted","initTags","methods","isActive","route","isAffix","tag","meta","affix","filterAffixTags","_this","basePath","arguments","length","undefined","tags","forEach","tagPath","resolve","push","fullPath","name","_objectSpread","children","tempTags","concat","_toConsumableArray","_iterator","_createForOfIteratorHelper","_step","s","n","done","dispatch","err","e","f","_this2","$refs","$nextTick","_iterator2","_step2","to","scrollPane","moveToTarget","refreshSelectedTag","view","_this3","then","$router","replace","closeSelectedTag","_this4","_ref","toLastView","closeOthersTags","_this5","closeAllTags","_this6","_ref2","some","latestView","slice","openMenu","menuMinWidth","offsetLeft","$el","getBoundingClientRect","offsetWidth","maxLeft","clientX","clientY","handleScroll"],"sources":["src/layout/components/TagsView/index.vue"],"sourcesContent":["<template>\r\n <div id=\"tags-view-container\" class=\"tags-view-container\">\r\n <scroll-pane ref=\"scrollPane\" class=\"tags-view-wrapper\" @scroll=\"handleScroll\">\r\n <router-link\r\n v-for=\"tag in visitedViews\"\r\n ref=\"tag\"\r\n :key=\"tag.path\"\r\n :class=\"isActive(tag)?'active':''\"\r\n :to=\"{ path: tag.path, query: tag.query, fullPath: tag.fullPath }\"\r\n tag=\"span\"\r\n class=\"tags-view-item\"\r\n @click.middle.native=\"!isAffix(tag)?closeSelectedTag(tag):''\"\r\n @contextmenu.prevent.native=\"openMenu(tag,$event)\"\r\n >\r\n {{ tag.title }}\r\n <span v-if=\"!isAffix(tag)\" class=\"el-icon-close\" @click.prevent.stop=\"closeSelectedTag(tag)\" />\r\n </router-link>\r\n </scroll-pane>\r\n <ul v-show=\"visible\" :style=\"{left:left+'px',top:top+'px'}\" class=\"contextmenu\">\r\n <li @click=\"refreshSelectedTag(selectedTag)\">刷新</li>\r\n <li v-if=\"!isAffix(selectedTag)\" @click=\"closeSelectedTag(selectedTag)\">关闭</li>\r\n <li @click=\"closeOthersTags\">关闭其他</li>\r\n <li @click=\"closeAllTags(selectedTag)\">关闭所有</li>\r\n </ul>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport ScrollPane from './ScrollPane'\r\nimport path from 'path'\r\n\r\nexport default {\r\n components: { ScrollPane },\r\n data() {\r\n return {\r\n visible: false,\r\n top: 0,\r\n left: 0,\r\n selectedTag: {},\r\n affixTags: []\r\n }\r\n },\r\n computed: {\r\n visitedViews() {\r\n return this.$store.state.tagsView.visitedViews\r\n },\r\n routes() {\r\n return this.$store.state.permission.routes\r\n }\r\n },\r\n watch: {\r\n $route() {\r\n this.addTags()\r\n this.moveToCurrentTag()\r\n },\r\n visible(value) {\r\n if (value) {\r\n document.body.addEventListener('click', this.closeMenu)\r\n } else {\r\n document.body.removeEventListener('click', this.closeMenu)\r\n }\r\n }\r\n },\r\n mounted() {\r\n this.initTags()\r\n this.addTags()\r\n },\r\n methods: {\r\n isActive(route) {\r\n return route.path === this.$route.path\r\n },\r\n isAffix(tag) {\r\n return tag.meta && tag.meta.affix\r\n },\r\n filterAffixTags(routes, basePath = '/') {\r\n let tags = []\r\n routes.forEach(route => {\r\n if (route.meta && route.meta.affix) {\r\n const tagPath = path.resolve(basePath, route.path)\r\n tags.push({\r\n fullPath: tagPath,\r\n path: tagPath,\r\n name: route.name,\r\n meta: { ...route.meta }\r\n })\r\n }\r\n if (route.children) {\r\n const tempTags = this.filterAffixTags(route.children, route.path)\r\n if (tempTags.length >= 1) {\r\n tags = [...tags, ...tempTags]\r\n }\r\n }\r\n })\r\n return tags\r\n },\r\n initTags() {\r\n const affixTags = this.affixTags = this.filterAffixTags(this.routes)\r\n for (const tag of affixTags) {\r\n // Must have tag name\r\n if (tag.name) {\r\n this.$store.dispatch('tagsView/addVisitedView', tag)\r\n }\r\n }\r\n },\r\n addTags() {\r\n const { name } = this.$route\r\n if (name) {\r\n this.$store.dispatch('tagsView/addView', this.$route)\r\n }\r\n return false\r\n },\r\n moveToCurrentTag() {\r\n const tags = this.$refs.tag\r\n this.$nextTick(() => {\r\n for (const tag of tags) {\r\n if (tag.to.path === this.$route.path) {\r\n this.$refs.scrollPane.moveToTarget(tag)\r\n // when query is different then update\r\n if (tag.to.fullPath !== this.$route.fullPath) {\r\n this.$store.dispatch('tagsView/updateVisitedView', this.$route)\r\n }\r\n break\r\n }\r\n }\r\n })\r\n },\r\n refreshSelectedTag(view) {\r\n this.$store.dispatch('tagsView/delCachedView', view).then(() => {\r\n const { fullPath } = view\r\n this.$nextTick(() => {\r\n this.$router.replace({\r\n path: '/redirect' + fullPath\r\n })\r\n })\r\n })\r\n },\r\n closeSelectedTag(view) {\r\n this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {\r\n if (this.isActive(view)) {\r\n this.toLastView(visitedViews, view)\r\n }\r\n })\r\n },\r\n closeOthersTags() {\r\n this.$router.push(this.selectedTag)\r\n this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {\r\n this.moveToCurrentTag()\r\n })\r\n },\r\n closeAllTags(view) {\r\n this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {\r\n if (this.affixTags.some(tag => tag.path === view.path)) {\r\n return\r\n }\r\n this.toLastView(visitedViews, view)\r\n })\r\n },\r\n toLastView(visitedViews, view) {\r\n const latestView = visitedViews.slice(-1)[0]\r\n if (latestView) {\r\n this.$router.push(latestView.fullPath)\r\n } else {\r\n // now the default is to redirect to the home page if there is no tags-view,\r\n // you can adjust it according to your needs.\r\n if (view.name === 'Dashboard') {\r\n // to reload home page\r\n this.$router.replace({ path: '/redirect' + view.fullPath })\r\n } else {\r\n this.$router.push('/')\r\n }\r\n }\r\n },\r\n openMenu(tag, e) {\r\n const menuMinWidth = 105\r\n const offsetLeft = this.$el.getBoundingClientRect().left // container margin left\r\n const offsetWidth = this.$el.offsetWidth // container width\r\n const maxLeft = offsetWidth - menuMinWidth // left boundary\r\n const left = e.clientX - offsetLeft + 15 // 15: margin right\r\n\r\n if (left > maxLeft) {\r\n this.left = maxLeft\r\n } else {\r\n this.left = left\r\n }\r\n\r\n this.top = e.clientY\r\n this.visible = true\r\n this.selectedTag = tag\r\n },\r\n closeMenu() {\r\n this.visible = false\r\n },\r\n handleScroll() {\r\n this.closeMenu()\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.tags-view-container {\r\n height: 34px;\r\n width: 100%;\r\n background: #fff;\r\n border-bottom: 1px solid #d8dce5;\r\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);\r\n .tags-view-wrapper {\r\n .tags-view-item {\r\n display: inline-block;\r\n position: relative;\r\n cursor: pointer;\r\n height: 26px;\r\n line-height: 26px;\r\n border: 1px solid #d8dce5;\r\n color: #495060;\r\n background: #fff;\r\n padding: 0 8px;\r\n font-size: 12px;\r\n margin-left: 5px;\r\n margin-top: 4px;\r\n &:first-of-type {\r\n margin-left: 15px;\r\n }\r\n &:last-of-type {\r\n margin-right: 15px;\r\n }\r\n &.active {\r\n background-color: #42b983;\r\n color: #fff;\r\n border-color: #42b983;\r\n &::before {\r\n content: '';\r\n background: #fff;\r\n display: inline-block;\r\n width: 8px;\r\n height: 8px;\r\n border-radius: 50%;\r\n position: relative;\r\n margin-right: 2px;\r\n }\r\n }\r\n }\r\n }\r\n .contextmenu {\r\n margin: 0;\r\n background: #fff;\r\n z-index: 3000;\r\n position: absolute;\r\n list-style-type: none;\r\n padding: 5px 0;\r\n border-radius: 4px;\r\n font-size: 12px;\r\n font-weight: 400;\r\n color: #333;\r\n box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);\r\n li {\r\n margin: 0;\r\n padding: 7px 16px;\r\n cursor: pointer;\r\n &:hover {\r\n background: #eee;\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\">\r\n//reset element css of el-icon-close\r\n.tags-view-wrapper {\r\n .tags-view-item {\r\n .el-icon-close {\r\n width: 16px;\r\n height: 16px;\r\n vertical-align: 2px;\r\n border-radius: 50%;\r\n text-align: center;\r\n transition: all .3s cubic-bezier(.645, .045, .355, 1);\r\n transform-origin: 100% 50%;\r\n &:before {\r\n transform: scale(.6);\r\n display: inline-block;\r\n vertical-align: -3px;\r\n }\r\n &:hover {\r\n background-color: #b4bccc;\r\n color: #fff;\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,OAAAA,UAAA;AACA,OAAAC,IAAA;AAEA;EACAC,UAAA;IAAAF,UAAA,EAAAA;EAAA;EACAG,IAAA,WAAAA,KAAA;IACA;MACAC,OAAA;MACAC,GAAA;MACAC,IAAA;MACAC,WAAA;MACAC,SAAA;IACA;EACA;EACAC,QAAA;IACAC,YAAA,WAAAA,aAAA;MACA,YAAAC,MAAA,CAAAC,KAAA,CAAAC,QAAA,CAAAH,YAAA;IACA;IACAI,MAAA,WAAAA,OAAA;MACA,YAAAH,MAAA,CAAAC,KAAA,CAAAG,UAAA,CAAAD,MAAA;IACA;EACA;EACAE,KAAA;IACAC,MAAA,WAAAA,OAAA;MACA,KAAAC,OAAA;MACA,KAAAC,gBAAA;IACA;IACAf,OAAA,WAAAA,QAAAgB,KAAA;MACA,IAAAA,KAAA;QACAC,QAAA,CAAAC,IAAA,CAAAC,gBAAA,eAAAC,SAAA;MACA;QACAH,QAAA,CAAAC,IAAA,CAAAG,mBAAA,eAAAD,SAAA;MACA;IACA;EACA;EACAE,OAAA,WAAAA,QAAA;IACA,KAAAC,QAAA;IACA,KAAAT,OAAA;EACA;EACAU,OAAA;IACAC,QAAA,WAAAA,SAAAC,KAAA;MACA,OAAAA,KAAA,CAAA7B,IAAA,UAAAgB,MAAA,CAAAhB,IAAA;IACA;IACA8B,OAAA,WAAAA,QAAAC,GAAA;MACA,OAAAA,GAAA,CAAAC,IAAA,IAAAD,GAAA,CAAAC,IAAA,CAAAC,KAAA;IACA;IACAC,eAAA,WAAAA,gBAAArB,MAAA;MAAA,IAAAsB,KAAA;MAAA,IAAA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