@explorer-1/vue 0.2.82 → 0.2.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -163,12 +163,19 @@ export default defineComponent({
|
|
|
163
163
|
return undefined
|
|
164
164
|
},
|
|
165
165
|
computedTo() {
|
|
166
|
-
let toValue = this.to
|
|
166
|
+
let toValue = this.to ? this.addTrailingSlash(this.to as string) : undefined
|
|
167
167
|
// filter out unnecessary `/home/` prefix from wagtail default site urlPaths
|
|
168
168
|
if (toValue && typeof toValue === 'string' && toValue.startsWith('/home/')) {
|
|
169
169
|
toValue = toValue.replace('/home/', '/')
|
|
170
170
|
}
|
|
171
171
|
return toValue
|
|
172
|
+
},
|
|
173
|
+
computedHref() {
|
|
174
|
+
let hrefValue =
|
|
175
|
+
this.href && (this.href.includes('jpl.nasa.gov') || this.href.includes('localhost'))
|
|
176
|
+
? this.addTrailingSlash(this.href as string)
|
|
177
|
+
: this.href
|
|
178
|
+
return hrefValue
|
|
172
179
|
}
|
|
173
180
|
},
|
|
174
181
|
methods: {
|
|
@@ -176,6 +183,48 @@ export default defineComponent({
|
|
|
176
183
|
this.$root?.$emit('linkClicked')
|
|
177
184
|
this.$emit('specificLinkClicked')
|
|
178
185
|
eventBus.emit('linkClicked')
|
|
186
|
+
},
|
|
187
|
+
addTrailingSlash(path: string) {
|
|
188
|
+
let filteredPath = path
|
|
189
|
+
if (path && typeof path === 'string') {
|
|
190
|
+
const isFilePath = () => {
|
|
191
|
+
const afterLastSlash = path.split('/').pop()
|
|
192
|
+
if (afterLastSlash && afterLastSlash.includes('.')) {
|
|
193
|
+
return true
|
|
194
|
+
}
|
|
195
|
+
return false
|
|
196
|
+
}
|
|
197
|
+
const isQueryPath = path.includes('?')
|
|
198
|
+
const isAnchorPath = path.includes('#')
|
|
199
|
+
if (
|
|
200
|
+
!isQueryPath &&
|
|
201
|
+
!isAnchorPath &&
|
|
202
|
+
!isFilePath() &&
|
|
203
|
+
path !== '/' &&
|
|
204
|
+
!path.endsWith('/') &&
|
|
205
|
+
!path.startsWith('/preview')
|
|
206
|
+
) {
|
|
207
|
+
// add a trailing slash if there isn't one
|
|
208
|
+
filteredPath += '/'
|
|
209
|
+
} else if (isQueryPath) {
|
|
210
|
+
if (!path.includes('/?')) {
|
|
211
|
+
// also add a trailing slash to paths with query params
|
|
212
|
+
const urlParts = filteredPath.split('?')
|
|
213
|
+
const pathWithSlash = `${urlParts[0]}/`
|
|
214
|
+
const queryParams = urlParts[1]
|
|
215
|
+
filteredPath = pathWithSlash + '?' + queryParams
|
|
216
|
+
}
|
|
217
|
+
} else if (isAnchorPath) {
|
|
218
|
+
if (!path.includes('/#')) {
|
|
219
|
+
// also add a trailing slash to paths with anchors
|
|
220
|
+
const urlParts = filteredPath.split('#')
|
|
221
|
+
const pathWithSlash = `${urlParts[0]}/`
|
|
222
|
+
const anchor = urlParts[1]
|
|
223
|
+
filteredPath = pathWithSlash + '#' + anchor
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return filteredPath
|
|
179
228
|
}
|
|
180
229
|
}
|
|
181
230
|
})
|
|
@@ -220,8 +269,8 @@ export default defineComponent({
|
|
|
220
269
|
</template>
|
|
221
270
|
</nuxt-link>
|
|
222
271
|
<a
|
|
223
|
-
v-else-if="
|
|
224
|
-
:href="
|
|
272
|
+
v-else-if="computedHref"
|
|
273
|
+
:href="computedHref"
|
|
225
274
|
class="group"
|
|
226
275
|
:class="computedClass"
|
|
227
276
|
:target="theTarget"
|
|
@@ -3,14 +3,7 @@
|
|
|
3
3
|
v-if="hasContent"
|
|
4
4
|
heading="Past Events"
|
|
5
5
|
variant="cards"
|
|
6
|
-
|
|
7
|
-
// path: 'events',
|
|
8
|
-
query: {
|
|
9
|
-
event_status: 'Past events',
|
|
10
|
-
sortBy: 'eventStartDateLatest',
|
|
11
|
-
page: '1'
|
|
12
|
-
}
|
|
13
|
-
}"
|
|
6
|
+
link="/events/?page=1&event_status=Past+events&sortBy=eventStartDateLatest"
|
|
14
7
|
link-title="View all past events"
|
|
15
8
|
indent="col-1"
|
|
16
9
|
v-bind="$attrs"
|