File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 108
108
shouldStable : false ,
109
109
version : versionNumber ,
110
110
oldVersion : undefined ,
111
- versionOptions : [ 'master' ]
111
+ versionOptions : [ 'master' ] ,
112
+ scrolledOnce : false ,
112
113
} ,
113
114
asyncComputed : {
114
115
async outputHtml ( ) {
158
159
renderer . heading = function ( text , level ) {
159
160
const id = htmlToId ( text ) ;
160
161
return `<h${ level } >
161
- <a href="#${ id } " name="${ id } " class="header-link">${ text } </a>
162
+ <a id=" ${ id } " href="#${ id } " name="${ id } " class="header-link">${ text } </a>
162
163
</h${ level } >` ;
163
164
} ;
164
165
186
187
. filter ( tag => tag . startsWith ( 'v' ) ) ;
187
188
this . versionOptions = this . versionOptions . concat ( tagOptions ) ;
188
189
} ,
189
- mounted ( ) {
190
+ updated ( ) {
190
191
if ( UrlHash === '' ) return ;
191
- const target = document . querySelector ( `#${ UrlHash } ` ) ;
192
- if ( target != null ) {
193
- target . scrollIntoView ( true ) ;
194
- }
192
+ this . $nextTick ( ( ) => {
193
+ const target = document . querySelector ( `#${ UrlHash } ` ) ;
194
+ if ( target != null && ! this . scrolledOnce ) {
195
+ target . scrollIntoView ( true ) ;
196
+ this . scrolledOnce = true ;
197
+ }
198
+ } ) ;
195
199
} ,
196
200
methods : {
197
201
handleReqFailure ( e ) {
You can’t perform that action at this time.
0 commit comments