File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
src/views/layout/components Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -14,16 +14,21 @@ export default {
1414 left: 0
1515 }
1616 },
17+ computed: {
18+ scrollWrapper () {
19+ return this .$refs .scrollContainer .$refs .wrap
20+ }
21+ },
1722 methods: {
1823 handleScroll (e ) {
1924 const eventDelta = e .wheelDelta || - e .deltaY * 40
20- const $scrollWrapper = this .$refs . scrollContainer . $refs . wrap
25+ const $scrollWrapper = this .scrollWrapper
2126 $scrollWrapper .scrollLeft = $scrollWrapper .scrollLeft + eventDelta / 4
2227 },
2328 moveToTarget (currentTag ) {
2429 const $container = this .$refs .scrollContainer .$el
2530 const $containerWidth = $container .offsetWidth
26- const $scrollWrapper = this .$refs . scrollContainer . $refs . wrap
31+ const $scrollWrapper = this .scrollWrapper
2732 const tagList = this .$parent .$refs .tag
2833
2934 let firstTag = null
@@ -44,6 +49,7 @@ export default {
4449 const currentIndex = tagList .findIndex (item => item === currentTag)
4550 const prevTag = tagList[currentIndex - 1 ]
4651 const nextTag = tagList[currentIndex + 1 ]
52+
4753 // the tag's offsetLeft after of nextTag
4854 const afterNextTagOffsetLeft = nextTag .$el .offsetLeft + nextTag .$el .offsetWidth + tagAndTagSpacing
4955
Original file line number Diff line number Diff line change 2626</template >
2727
2828<script >
29- import ScrollPane from ' @/components /ScrollPane'
29+ import ScrollPane from ' . /ScrollPane'
3030import { generateTitle } from ' @/utils/i18n'
3131import path from ' path'
3232
@@ -90,7 +90,6 @@ export default {
9090 }
9191 }
9292 })
93-
9493 return tags
9594 },
9695 initTags () {
@@ -115,12 +114,10 @@ export default {
115114 for (const tag of tags) {
116115 if (tag .to .path === this .$route .path ) {
117116 this .$refs .scrollPane .moveToTarget (tag)
118-
119117 // when query is different then update
120118 if (tag .to .fullPath !== this .$route .fullPath ) {
121119 this .$store .dispatch (' updateVisitedView' , this .$route )
122120 }
123-
124121 break
125122 }
126123 }
@@ -178,8 +175,8 @@ export default {
178175 } else {
179176 this .left = left
180177 }
181- this .top = e .clientY
182178
179+ this .top = e .clientY
183180 this .visible = true
184181 this .selectedTag = tag
185182 },
Original file line number Diff line number Diff line change 11export { default as Navbar } from './Navbar'
22export { default as Sidebar } from './Sidebar/index.vue'
3- export { default as TagsView } from './TagsView'
3+ export { default as TagsView } from './TagsView/index.vue '
44export { default as AppMain } from './AppMain'
You can’t perform that action at this time.
0 commit comments