Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
80410b44
Commit
80410b44
authored
Sep 30, 2018
by
hetech
Committed by
GitHub
Sep 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tabs: scroll to active tab (#12948)
* Tabs: fix not scrolling to active tab * update tabs.vue
parent
7e29e1c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
packages/tabs/src/tab-nav.vue
packages/tabs/src/tab-nav.vue
+4
-5
packages/tabs/src/tabs.vue
packages/tabs/src/tabs.vue
+4
-2
No files found.
packages/tabs/src/tab-nav.vue
View file @
80410b44
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
const
navScroll
=
this
.
$refs
.
navScroll
;
const
navScroll
=
this
.
$refs
.
navScroll
;
const
activeTabBounding
=
activeTab
.
getBoundingClientRect
();
const
activeTabBounding
=
activeTab
.
getBoundingClientRect
();
const
navScrollBounding
=
navScroll
.
getBoundingClientRect
();
const
navScrollBounding
=
navScroll
.
getBoundingClientRect
();
const
navBounding
=
nav
.
getBoundingClientRect
()
;
const
maxOffset
=
nav
.
offsetWidth
-
navScrollBounding
.
width
;
const
currentOffset
=
this
.
navOffset
;
const
currentOffset
=
this
.
navOffset
;
let
newOffset
=
currentOffset
;
let
newOffset
=
currentOffset
;
...
@@ -97,10 +97,9 @@
...
@@ -97,10 +97,9 @@
if
(
activeTabBounding
.
right
>
navScrollBounding
.
right
)
{
if
(
activeTabBounding
.
right
>
navScrollBounding
.
right
)
{
newOffset
=
currentOffset
+
activeTabBounding
.
right
-
navScrollBounding
.
right
;
newOffset
=
currentOffset
+
activeTabBounding
.
right
-
navScrollBounding
.
right
;
}
}
if
(
navBounding
.
right
<
navScrollBounding
.
right
)
{
newOffset
=
nav
.
offsetWidth
-
navScrollBounding
.
width
;
newOffset
=
Math
.
max
(
newOffset
,
0
);
}
this
.
navOffset
=
Math
.
min
(
newOffset
,
maxOffset
);
this
.
navOffset
=
Math
.
max
(
newOffset
,
0
);
},
},
update
()
{
update
()
{
if
(
!
this
.
$refs
.
nav
)
return
;
if
(
!
this
.
$refs
.
nav
)
return
;
...
...
packages/tabs/src/tabs.vue
View file @
80410b44
...
@@ -45,8 +45,10 @@
...
@@ -45,8 +45,10 @@
},
},
currentName
(
value
)
{
currentName
(
value
)
{
if
(
this
.
$refs
.
nav
)
{
if
(
this
.
$refs
.
nav
)
{
this
.
$nextTick
(
_
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
nav
.
scrollToActiveTab
();
this
.
$refs
.
nav
.
$nextTick
(
_
=>
{
this
.
$refs
.
nav
.
scrollToActiveTab
();
});
});
});
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment