File tree Expand file tree Collapse file tree 1 file changed +28
-5
lines changed
Expand file tree Collapse file tree 1 file changed +28
-5
lines changed Original file line number Diff line number Diff line change 1- console . log ( 'custom.js ----' )
2-
3- window . addEventListener ( 'DOMContentLoaded' , ( ) => {
4- console . log ( 'DOMContentLoaded' )
5- } )
1+ console . log (
2+ '%cbuild from PakePlus: https://github.com/Sjj1024/PakePlus' ,
3+ 'color:orangered;font-weight:bolder'
4+ )
5+
6+ // very important, if you don't know what it is, don't touch it
7+ // 非常重要,不懂代码不要动,这里可以解决80%的问题,也可以生产1000+的bug
8+ const hookClick = ( e ) => {
9+ const origin = e . target . closest ( 'a' )
10+ const isBaseTargetBlank = document . querySelector (
11+ 'head base[target="_blank"]'
12+ )
13+ console . log ( 'origin' , origin , isBaseTargetBlank )
14+ if (
15+ ( origin && origin . href && origin . target === '_blank' ) ||
16+ ( origin && origin . href && isBaseTargetBlank )
17+ ) {
18+ e . preventDefault ( )
19+ console . log ( 'handle origin' , origin )
20+ location . href = origin . href
21+ } else {
22+ console . log ( 'not handle origin' , origin )
23+ }
24+ }
25+
26+ document . addEventListener ( 'click' , hookClick , { capture : true } )
27+
28+ var vConsole = new window . VConsole ( )
You can’t perform that action at this time.
0 commit comments