travel/admin/node_modules/.cache/vue-loader/abbd4c65377fffd08a68f2b7ecf...

1 line
11 KiB
JSON

{"remainingRequest":"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=style&index=1&id=fac8ca64&lang=scss","dependencies":[{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\layout\\components\\TagsView\\index.vue","mtime":1718070786027},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\css-loader\\dist\\cjs.js","mtime":1718764958140},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":1718764960674},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\postcss-loader\\src\\index.js","mtime":1718764958994},{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\node_modules\\sass-loader\\dist\\cjs.js","mtime":1718764957182},{"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:CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKDQovL3Jlc2V0IGVsZW1lbnQgY3NzIG9mIGVsLWljb24tY2xvc2UNCi50YWdzLXZpZXctd3JhcHBlciB7DQogIC50YWdzLXZpZXctaXRlbSB7DQogICAgLmVsLWljb24tY2xvc2Ugew0KICAgICAgd2lkdGg6IDE2cHg7DQogICAgICBoZWlnaHQ6IDE2cHg7DQogICAgICB2ZXJ0aWNhbC1hbGlnbjogMnB4Ow0KICAgICAgYm9yZGVyLXJhZGl1czogNTAlOw0KICAgICAgdGV4dC1hbGlnbjogY2VudGVyOw0KICAgICAgdHJhbnNpdGlvbjogYWxsIC4zcyBjdWJpYy1iZXppZXIoLjY0NSwgLjA0NSwgLjM1NSwgMSk7DQogICAgICB0cmFuc2Zvcm0tb3JpZ2luOiAxMDAlIDUwJTsNCiAgICAgICY6YmVmb3JlIHsNCiAgICAgICAgdHJhbnNmb3JtOiBzY2FsZSguNik7DQogICAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jazsNCiAgICAgICAgdmVydGljYWwtYWxpZ246IC0zcHg7DQogICAgICB9DQogICAgICAmOmhvdmVyIHsNCiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2I0YmNjYzsNCiAgICAgICAgY29sb3I6ICNmZmY7DQogICAgICB9DQogICAgfQ0KICB9DQp9DQo="},{"version":3,"sources":["index.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.vue","sourceRoot":"src/layout/components/TagsView","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"]}]}