File tree 1 file changed +34
-53
lines changed
src/runtime/inertia/components
1 file changed +34
-53
lines changed Original file line number Diff line number Diff line change @@ -110,72 +110,53 @@ const linkClass = computed(() => {
110
110
})
111
111
112
112
const page = usePage ()
113
- const url = computed (() => props .to ?? props .href ?? ' # ' )
113
+ const url = computed (() => props .to ?? props .href ?? ' ' )
114
114
115
115
const isActive = computed (() => props .active || (props .exact ? url .value === props .href : page ?.url .startsWith (url .value )))
116
116
</script >
117
117
118
118
<template >
119
- <template v-if =" ! isExternal " >
120
- <InertiaLink v-bind =" routerLinkProps" :href =" url" custom >
121
- <template v-if =" custom " >
122
- <slot
123
- v-bind =" {
124
- ...$attrs,
125
- as,
126
- type,
127
- disabled,
128
- href: url,
129
- active: isActive
130
- }"
131
- />
132
- </template >
133
- <ULinkBase
134
- v-else
135
- v-bind =" {
136
- ...$attrs,
137
- as,
138
- type,
139
- disabled,
140
- href: url,
141
- active: isActive
142
- }"
143
- :class =" linkClass"
144
- >
145
- <slot :active =" isActive" />
146
- </ULinkBase >
147
- </InertiaLink >
148
- </template >
149
-
150
- <template v-else >
151
- <template v-if =" custom " >
152
- <slot
153
- v-bind =" {
154
- ...$attrs,
155
- as,
156
- type,
157
- disabled,
158
- href: to,
159
- target: isExternal ? '_blank' : undefined,
160
- active: isActive
161
- }"
162
- />
163
- </template >
164
- <ULinkBase
165
- v-else
119
+ <InertiaLink v-if =" !isExternal && custom && !!url" v-bind =" routerLinkProps" :href =" url" >
120
+ <slot
166
121
v-bind =" {
167
122
...$attrs,
168
123
as,
169
124
type,
170
125
disabled,
171
126
href: url,
127
+ active: isActive
128
+ }"
129
+ />
130
+ </InertiaLink >
131
+
132
+ <template v-else-if =" custom " >
133
+ <slot
134
+ v-bind =" {
135
+ ...$attrs,
136
+ as,
137
+ type,
138
+ disabled,
139
+ href: to,
172
140
target: isExternal ? '_blank' : undefined,
173
141
active: isActive
174
142
}"
175
- :is-external =" isExternal"
176
- :class =" linkClass"
177
- >
178
- <slot :active =" isActive" />
179
- </ULinkBase >
143
+ />
180
144
</template >
145
+
146
+ <ULinkBase
147
+ v-else
148
+ v-bind =" {
149
+ ...$attrs,
150
+ as,
151
+ type,
152
+ disabled,
153
+ href: url,
154
+ target: isExternal ? '_blank' : undefined,
155
+ active: isActive
156
+ }"
157
+ :is-external =" isExternal"
158
+ :class =" linkClass"
159
+ >
160
+ <slot :active =" isActive" />
161
+ </ULinkBase >
181
162
</template >
You can’t perform that action at this time.
0 commit comments