@@ -88,7 +88,7 @@ export interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
88
88
noPrefetch ?: boolean
89
89
}
90
90
91
- /*@__NO_SIDE_EFFECTS__ */
91
+ /*@__NO_SIDE_EFFECTS__ */
92
92
export function defineNuxtLink ( options : NuxtLinkOptions ) {
93
93
const componentName = options . componentName || 'NuxtLink'
94
94
@@ -100,7 +100,6 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
100
100
101
101
function resolveTrailingSlashBehavior ( to : string , resolve : Router [ 'resolve' ] ) : string
102
102
function resolveTrailingSlashBehavior ( to : RouteLocationRaw , resolve : Router [ 'resolve' ] ) : Exclude < RouteLocationRaw , string >
103
- function resolveTrailingSlashBehavior ( to : undefined , resolve : Router [ 'resolve' ] ) : undefined
104
103
function resolveTrailingSlashBehavior ( to : RouteLocationRaw | undefined , resolve : Router [ 'resolve' ] ) : RouteLocationRaw | RouteLocation | undefined {
105
104
if ( ! to || ( options . trailingSlash !== 'append' && options . trailingSlash !== 'remove' ) ) {
106
105
return to
@@ -117,6 +116,7 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
117
116
path : applyTrailingSlashBehavior ( path , options . trailingSlash )
118
117
}
119
118
119
+ // named routes would otherwise always override trailing slash behavior
120
120
if ( 'name' in resolvedPath ) {
121
121
delete resolvedPath . name
122
122
}
@@ -332,8 +332,8 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
332
332
const href = typeof to . value === 'object'
333
333
? router . resolve ( to . value ) ?. href ?? null
334
334
: ( to . value && ! props . external && ! isAbsoluteUrl . value )
335
- ? resolveTrailingSlashBehavior ( joinURL ( config . app . baseURL , to . value ) , router . resolve ) as string
336
- : to . value || null
335
+ ? resolveTrailingSlashBehavior ( joinURL ( config . app . baseURL , to . value ) , router . resolve ) as string
336
+ : to . value || null
337
337
338
338
// Resolves `target` value
339
339
const target = props . target || null
0 commit comments