@@ -100,29 +100,38 @@ const handleCompatRedirect = async (router: Router) => {
100100 await replace ( '/guide/subscription' ) ;
101101 } else if ( location . pathname === '/' ) {
102102 const r = new URLSearchParams ( location . search ) . get ( 'r' ) ;
103+ const go = async ( to : string ) => {
104+ // 避免首次进入页面快速切换时出现闪烁
105+ const layoutEl = document . querySelector (
106+ '#app > .Layout' ,
107+ ) as HTMLDivElement ;
108+ layoutEl . style . visibility = 'hidden' ;
109+ await router . go ( to ) . catch ( ( ) => { } ) ;
110+ layoutEl . style . removeProperty ( 'visibility' ) ;
111+ } ;
103112 if ( r === '1' ) {
104- router . go ( '/guide/snapshot#how-to-upload' ) ;
113+ go ( '/guide/snapshot#how-to-upload' ) ;
105114 } else if ( r === '2' ) {
106- router . go ( '/guide/faq#restriction' ) ;
115+ go ( '/guide/faq#restriction' ) ;
107116 } else if ( r === '3' ) {
108- router . go ( '/guide/faq#adb_failed' ) ;
117+ go ( '/guide/faq#adb_failed' ) ;
109118 } else if ( r === '4' ) {
110119 location . href = 'https://shizuku.rikka.app' ;
111120 return ;
112121 } else if ( r === '5' ) {
113- router . go ( '/guide/subscription' ) ;
122+ go ( '/guide/subscription' ) ;
114123 } else if ( r === '6' ) {
115- router . go ( '/guide/faq#power' ) ;
124+ go ( '/guide/faq#power' ) ;
116125 } else if ( r === '7' ) {
117- router . go ( '/guide/faq#exact-activity' ) ;
126+ go ( '/guide/faq#exact-activity' ) ;
118127 } else if ( r === '8' ) {
119- router . go ( '/guide/faq#forced-tap' ) ;
128+ go ( '/guide/faq#forced-tap' ) ;
120129 } else if ( r === '9' ) {
121- router . go ( '/guide/faq#work-profile' ) ;
130+ go ( '/guide/faq#work-profile' ) ;
122131 } else if ( r === '10' ) {
123- router . go ( '/guide/sponsor' ) ;
132+ go ( '/guide/sponsor' ) ;
124133 } else if ( r === '11' ) {
125- router . go ( '/guide/privacy' ) ;
134+ go ( '/guide/privacy' ) ;
126135 }
127136 } else if ( u === '/guide/faq#fail_setting_secure_settings' ) {
128137 location . hash = 'adb_failed' ;
0 commit comments