@@ -90,8 +90,8 @@ export const AutoLink = defineComponent({
90
90
// If the `target` attr is "_blank"
91
91
const isBlankTarget = computed ( ( ) => linkTarget . value === '_blank' )
92
92
93
- // Render `<RouteLink>` or not
94
- const renderRouteLink = computed (
93
+ // Whether the link is internal
94
+ const isInternal = computed (
95
95
( ) => ! withProtocol . value && ! isBlankTarget . value ,
96
96
)
97
97
@@ -122,15 +122,15 @@ export const AutoLink = defineComponent({
122
122
} )
123
123
124
124
// If this link is active
125
- const isActive = computed ( ( ) =>
126
- renderRouteLink . value
127
- ? config . value . activeMatch
125
+ const isActive = computed (
126
+ ( ) =>
127
+ isInternal . value &&
128
+ ( config . value . activeMatch
128
129
? new RegExp ( config . value . activeMatch , 'u' ) . test ( route . path )
129
130
: // If this link is active in subpath
130
131
shouldBeActiveInSubpath . value
131
132
? route . path . startsWith ( config . value . link )
132
- : route . path === config . value . link
133
- : false ,
133
+ : route . path === config . value . link ) ,
134
134
)
135
135
136
136
return ( ) : VNode => {
@@ -143,15 +143,14 @@ export const AutoLink = defineComponent({
143
143
after ?.( ) ,
144
144
]
145
145
146
- return renderRouteLink . value
146
+ return isInternal . value
147
147
? h (
148
148
RouteLink ,
149
149
{
150
150
'class' : 'auto-link' ,
151
151
'to' : link ,
152
152
'active' : isActive . value ,
153
153
'aria-label' : linkAriaLabel . value ,
154
- // Class needs to be merged manually
155
154
} ,
156
155
( ) => content ,
157
156
)
0 commit comments