1 line
9.3 KiB
JSON
1 line
9.3 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\\ScrollPane.vue?vue&type=script&lang=js","dependencies":[{"path":"D:\\phpstudy_pro\\WWW\\travel\\admin\\src\\layout\\components\\TagsView\\ScrollPane.vue","mtime":1718070786026},{"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:aW1wb3J0ICJjb3JlLWpzL21vZHVsZXMvZXMuYXJyYXkuZmluZC1pbmRleC5qcyI7Ci8vCi8vCi8vCi8vCi8vCi8vCgp2YXIgdGFnQW5kVGFnU3BhY2luZyA9IDQ7IC8vIHRhZ0FuZFRhZ1NwYWNpbmcKCmV4cG9ydCBkZWZhdWx0IHsKICBuYW1lOiAnU2Nyb2xsUGFuZScsCiAgZGF0YTogZnVuY3Rpb24gZGF0YSgpIHsKICAgIHJldHVybiB7CiAgICAgIGxlZnQ6IDAKICAgIH07CiAgfSwKICBjb21wdXRlZDogewogICAgc2Nyb2xsV3JhcHBlcjogZnVuY3Rpb24gc2Nyb2xsV3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WcuJGVsLm9mZnNldExlZnQgKyBuZXh0VGFnLiRlbC5vZmZzZXRXaWR0aCArIHRhZ0FuZFRhZ1NwYWNpbmc7CgogICAgICAgIC8vIHRoZSB0YWcncyBvZmZzZXRMZWZ0IGJlZm9yZSBvZiBwcmV2VGFnCiAgICAgICAgdmFyIGJlZm9yZVByZXZUYWdPZmZzZXRMZWZ0ID0gcHJldlRhZy4kZWwub2Zmc2V0TGVmdCAtIHRhZ0FuZFRhZ1NwYWNpbmc7CiAgICAgICAgaWYgKGFmdGVyTmV4dFRhZ09mZnNldExlZnQgPiAkc2Nyb2xsV3JhcHBlci5zY3JvbGxMZWZ0ICsgJGNvbnRhaW5lcldpZHRoKSB7CiAgICAgICAgICAkc2Nyb2xsV3JhcHBlci5zY3JvbGxMZWZ0ID0gYWZ0ZXJOZXh0VGFnT2Zmc2V0TGVmdCAtICRjb250YWluZXJXaWR0aDsKICAgICAgICB9IGVsc2UgaWYgKGJlZm9yZVByZXZUYWdPZmZzZXRMZWZ0IDwgJHNjcm9sbFdyYXBwZXIuc2Nyb2xsTGVmdCkgewogICAgICAgICAgJHNjcm9sbFdyYXBwZXIuc2Nyb2xsTGVmdCA9IGJlZm9yZVByZXZUYWdPZmZzZXRMZWZ0OwogICAgICAgIH0KICAgICAgfQogICAgfQogIH0KfTs="},{"version":3,"names":["tagAndTagSpacing","name","data","left","computed","scrollWrapper","$refs","scrollContainer","wrap","mounted","addEventListener","emitScroll","beforeDestroy","removeEventListener","methods","handleScroll","e","eventDelta","wheelDelta","deltaY","$scrollWrapper","scrollLeft","$emit","moveToTarget","currentTag","$container","$el","$containerWidth","offsetWidth","tagList","$parent","tag","firstTag","lastTag","length","scrollWidth","currentIndex","findIndex","item","prevTag","nextTag","afterNextTagOffsetLeft","offsetLeft","beforePrevTagOffsetLeft"],"sources":["src/layout/components/TagsView/ScrollPane.vue"],"sourcesContent":["<template>\r\n <el-scrollbar ref=\"scrollContainer\" :vertical=\"false\" class=\"scroll-container\" @wheel.native.prevent=\"handleScroll\">\r\n <slot />\r\n </el-scrollbar>\r\n</template>\r\n\r\n<script>\r\nconst tagAndTagSpacing = 4 // tagAndTagSpacing\r\n\r\nexport default {\r\n name: 'ScrollPane',\r\n data() {\r\n return {\r\n left: 0\r\n }\r\n },\r\n computed: {\r\n scrollWrapper() {\r\n return this.$refs.scrollContainer.$refs.wrap\r\n }\r\n },\r\n mounted() {\r\n this.scrollWrapper.addEventListener('scroll', this.emitScroll, true)\r\n },\r\n beforeDestroy() {\r\n this.scrollWrapper.removeEventListener('scroll', this.emitScroll)\r\n },\r\n methods: {\r\n handleScroll(e) {\r\n const eventDelta = e.wheelDelta || -e.deltaY * 40\r\n const $scrollWrapper = this.scrollWrapper\r\n $scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4\r\n },\r\n emitScroll() {\r\n this.$emit('scroll')\r\n },\r\n moveToTarget(currentTag) {\r\n const $container = this.$refs.scrollContainer.$el\r\n const $containerWidth = $container.offsetWidth\r\n const $scrollWrapper = this.scrollWrapper\r\n const tagList = this.$parent.$refs.tag\r\n\r\n let firstTag = null\r\n let lastTag = null\r\n\r\n // find first tag and last tag\r\n if (tagList.length > 0) {\r\n firstTag = tagList[0]\r\n lastTag = tagList[tagList.length - 1]\r\n }\r\n\r\n if (firstTag === currentTag) {\r\n $scrollWrapper.scrollLeft = 0\r\n } else if (lastTag === currentTag) {\r\n $scrollWrapper.scrollLeft = $scrollWrapper.scrollWidth - $containerWidth\r\n } else {\r\n // find preTag and nextTag\r\n const currentIndex = tagList.findIndex(item => item === currentTag)\r\n const prevTag = tagList[currentIndex - 1]\r\n const nextTag = tagList[currentIndex + 1]\r\n\r\n // the tag's offsetLeft after of nextTag\r\n const afterNextTagOffsetLeft = nextTag.$el.offsetLeft + nextTag.$el.offsetWidth + tagAndTagSpacing\r\n\r\n // the tag's offsetLeft before of prevTag\r\n const beforePrevTagOffsetLeft = prevTag.$el.offsetLeft - tagAndTagSpacing\r\n\r\n if (afterNextTagOffsetLeft > $scrollWrapper.scrollLeft + $containerWidth) {\r\n $scrollWrapper.scrollLeft = afterNextTagOffsetLeft - $containerWidth\r\n } else if (beforePrevTagOffsetLeft < $scrollWrapper.scrollLeft) {\r\n $scrollWrapper.scrollLeft = beforePrevTagOffsetLeft\r\n }\r\n }\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.scroll-container {\r\n white-space: nowrap;\r\n position: relative;\r\n overflow: hidden;\r\n width: 100%;\r\n ::v-deep {\r\n .el-scrollbar__bar {\r\n bottom: 0px;\r\n }\r\n .el-scrollbar__wrap {\r\n height: 49px;\r\n }\r\n }\r\n}\r\n</style>\r\n"],"mappings":";;;;;;;;AAOA,IAAAA,gBAAA;;AAEA;EACAC,IAAA;EACAC,IAAA,WAAAA,KAAA;IACA;MACAC,IAAA;IACA;EACA;EACAC,QAAA;IACAC,aAAA,WAAAA,cAAA;MACA,YAAAC,KAAA,CAAAC,eAAA,CAAAD,KAAA,CAAAE,IAAA;IACA;EACA;EACAC,OAAA,WAAAA,QAAA;IACA,KAAAJ,aAAA,CAAAK,gBAAA,gBAAAC,UAAA;EACA;EACAC,aAAA,WAAAA,cAAA;IACA,KAAAP,aAAA,CAAAQ,mBAAA,gBAAAF,UAAA;EACA;EACAG,OAAA;IACAC,YAAA,WAAAA,aAAAC,CAAA;MACA,IAAAC,UAAA,GAAAD,CAAA,CAAAE,UAAA,KAAAF,CAAA,CAAAG,MAAA;MACA,IAAAC,cAAA,QAAAf,aAAA;MACAe,cAAA,CAAAC,UAAA,GAAAD,cAAA,CAAAC,UAAA,GAAAJ,UAAA;IACA;IACAN,UAAA,WAAAA,WAAA;MACA,KAAAW,KAAA;IACA;IACAC,YAAA,WAAAA,aAAAC,UAAA;MACA,IAAAC,UAAA,QAAAnB,KAAA,CAAAC,eAAA,CAAAmB,GAAA;MACA,IAAAC,eAAA,GAAAF,UAAA,CAAAG,WAAA;MACA,IAAAR,cAAA,QAAAf,aAAA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