1- import Vue from 'vue' ;
1+ import { createApp , nextTick } from 'vue' ;
22import $ from 'jquery' ;
33import { initVueSvg , vueDelimiters } from './VueComponentLoader.js' ;
44import { initTooltip } from '../modules/tippy.js' ;
55
66const { appSubUrl, assetUrlPrefix, pageData} = window . config ;
77
8- function initVueComponents ( ) {
9- Vue . component ( 'repo-search' , {
8+ function initVueComponents ( app ) {
9+ app . component ( 'repo-search' , {
1010 delimiters : vueDelimiters ,
1111 props : {
1212 searchLimit : {
@@ -138,13 +138,14 @@ function initVueComponents() {
138138 } ,
139139
140140 mounted ( ) {
141+ const el = document . getElementById ( 'dashboard-repo-list' ) ;
141142 this . changeReposFilter ( this . reposFilter ) ;
142- for ( const el of this . $ el. querySelectorAll ( '.tooltip' ) ) {
143- initTooltip ( el ) ;
143+ for ( const elTooltip of el . querySelectorAll ( '.tooltip' ) ) {
144+ initTooltip ( elTooltip ) ;
144145 }
145- $ ( this . $ el) . find ( '.dropdown' ) . dropdown ( ) ;
146+ $ ( el ) . find ( '.dropdown' ) . dropdown ( ) ;
146147 this . setCheckboxes ( ) ;
147- Vue . nextTick ( ( ) => {
148+ nextTick ( ( ) => {
148149 this . $refs . search . focus ( ) ;
149150 } ) ;
150151 } ,
@@ -192,7 +193,7 @@ function initVueComponents() {
192193 this . reposFilter = filter ;
193194 this . repos = [ ] ;
194195 this . page = 1 ;
195- Vue . set ( this . counts , `${ filter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
196+ this . counts [ `${ filter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
196197 this . searchRepos ( ) ;
197198 } ,
198199
@@ -261,7 +262,7 @@ function initVueComponents() {
261262 this . page = 1 ;
262263 this . repos = [ ] ;
263264 this . setCheckboxes ( ) ;
264- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
265+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
265266 this . searchRepos ( ) ;
266267 } ,
267268
@@ -283,7 +284,7 @@ function initVueComponents() {
283284 this . page = 1 ;
284285 this . repos = [ ] ;
285286 this . setCheckboxes ( ) ;
286- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
287+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
287288 this . searchRepos ( ) ;
288289 } ,
289290
@@ -297,7 +298,7 @@ function initVueComponents() {
297298 this . page = 1 ;
298299 }
299300 this . repos = [ ] ;
300- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
301+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
301302 this . searchRepos ( ) ;
302303 } ,
303304
@@ -331,7 +332,7 @@ function initVueComponents() {
331332 if ( searchedQuery === '' && searchedMode === '' && this . archivedFilter === 'both' ) {
332333 this . reposTotalCount = count ;
333334 }
334- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , count ) ;
335+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = count ;
335336 this . finalPage = Math . ceil ( count / this . searchLimit ) ;
336337 this . updateHistory ( ) ;
337338 this . isLoading = false ;
@@ -352,27 +353,28 @@ function initVueComponents() {
352353 }
353354 return 'octicon-repo' ;
354355 }
355- }
356+ } ,
357+
358+ template : document . getElementById ( 'dashboard-repo-list-template' ) ,
356359 } ) ;
357360}
358361
359-
360362export function initDashboardRepoList ( ) {
361363 const el = document . getElementById ( 'dashboard-repo-list' ) ;
362364 const dashboardRepoListData = pageData . dashboardRepoList || null ;
363365 if ( ! el || ! dashboardRepoListData ) return ;
364366
365- initVueSvg ( ) ;
366- initVueComponents ( ) ;
367- new Vue ( {
368- el,
367+ const app = createApp ( {
369368 delimiters : vueDelimiters ,
370- data : ( ) => {
369+ data ( ) {
371370 return {
372371 searchLimit : dashboardRepoListData . searchLimit || 0 ,
373372 subUrl : appSubUrl ,
374373 uid : dashboardRepoListData . uid || 0 ,
375374 } ;
376375 } ,
377376 } ) ;
377+ initVueSvg ( app ) ;
378+ initVueComponents ( app ) ;
379+ app . mount ( el ) ;
378380}
0 commit comments