cec-nuxt-lib 0.4.1 → 0.4.3
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/dist/module.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useState } from '#app';
|
|
2
|
+
import { useState, useRuntimeConfig } from '#app';
|
|
3
3
|
import { useRoute } from 'vue-router';
|
|
4
4
|
|
|
5
|
+
const config = useRuntimeConfig();
|
|
6
|
+
const baseUrl = config.app.baseURL;
|
|
7
|
+
|
|
5
8
|
const classicPath = useState('classicPath');
|
|
6
9
|
const route = useRoute();
|
|
7
10
|
|
|
@@ -41,10 +44,20 @@ let routes = makeArr(routeTrim);
|
|
|
41
44
|
// Get the classic path for legacy links
|
|
42
45
|
let classic = trimPath(classicPath.value).split('/');
|
|
43
46
|
const length = classic.length;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'/'
|
|
47
|
-
|
|
47
|
+
let hrefs;
|
|
48
|
+
if (baseUrl !== '/') {
|
|
49
|
+
hrefs = `${classicPath.value}${routeTrim === '/' ? '' : routeTrim}`.split(
|
|
50
|
+
'/'
|
|
51
|
+
);
|
|
52
|
+
} else {
|
|
53
|
+
hrefs = routes.reduce((acc, e, i) => {
|
|
54
|
+
if (classic[i]) {
|
|
55
|
+
return [...acc, classic[i]];
|
|
56
|
+
} else {
|
|
57
|
+
return [...acc, e];
|
|
58
|
+
}
|
|
59
|
+
}, []);
|
|
60
|
+
}
|
|
48
61
|
const links = hrefs.map((e, i) => (!i ? 'Home' : toTitleCase(e)));
|
|
49
62
|
</script>
|
|
50
63
|
<template>
|
package/package.json
CHANGED