File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 8787 const navScroll = this .$refs .navScroll ;
8888 const activeTabBounding = activeTab .getBoundingClientRect ();
8989 const navScrollBounding = navScroll .getBoundingClientRect ();
90- const navBounding = nav .getBoundingClientRect () ;
90+ const maxOffset = nav .offsetWidth - navScrollBounding . width ;
9191 const currentOffset = this .navOffset ;
9292 let newOffset = currentOffset;
9393
9797 if (activeTabBounding .right > navScrollBounding .right ) {
9898 newOffset = currentOffset + activeTabBounding .right - navScrollBounding .right ;
9999 }
100- if (navBounding .right < navScrollBounding .right ) {
101- newOffset = nav .offsetWidth - navScrollBounding .width ;
102- }
103- this .navOffset = Math .max (newOffset, 0 );
100+
101+ newOffset = Math .max (newOffset, 0 );
102+ this .navOffset = Math .min (newOffset, maxOffset);
104103 },
105104 update () {
106105 if (! this .$refs .nav ) return ;
Original file line number Diff line number Diff line change 4545 },
4646 currentName (value ) {
4747 if (this .$refs .nav ) {
48- this .$nextTick (_ => {
49- this .$refs .nav .scrollToActiveTab ();
48+ this .$nextTick (() => {
49+ this .$refs .nav .$nextTick (_ => {
50+ this .$refs .nav .scrollToActiveTab ();
51+ });
5052 });
5153 }
5254 }
You can’t perform that action at this time.
0 commit comments