cec-nuxt-lib 0.1.4 → 0.1.5

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,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-vue-lib",
3
3
  "configKey": "cec-vue-lib",
4
- "version": "0.1.4"
4
+ "version": "0.1.5"
5
5
  }
@@ -5,20 +5,10 @@ import { useRoute } from 'vue-router';
5
5
 
6
6
  const config = useRuntimeConfig();
7
7
  const route = useRoute();
8
-
9
- const baseUrl = config.app.baseURL;
10
8
  const classicPath = useState('classicPath');
11
- const path = useState('path');
12
-
13
- // Used to make the Nuxt links
14
- let routes = route.path.split('/');
15
- const length = path.value.split('/').length - 1;
16
-
17
- let truePath = classicPath.value;
18
- if (baseUrl && route.path !== '/') {
19
- truePath += route.path;
20
- }
9
+ const baseUrl = config.app.baseURL;
21
10
 
11
+ // Helper functions
22
12
  const makeLink = (i) => {
23
13
  let diff = i - length;
24
14
  if (!diff) {
@@ -37,7 +27,19 @@ const toTitleCase = (str) => {
37
27
  );
38
28
  };
39
29
 
40
- let hrefs = truePath === '/' ? [''] : truePath.split('/');
30
+ // Used to make the Nuxt links
31
+ let routes = route.path.split('/');
32
+ let classic = classicPath.value.split('/');
33
+ const length = classic.length - 1;
34
+ let hrefs;
35
+
36
+ if (baseUrl.length > 1 && route.path !== '/') {
37
+ hrefs = (classicPath.value + route.path).split('/');
38
+ } else {
39
+ hrefs = routes.reduce((acc, e, i) => {
40
+ return classic[i] ? [...acc, classic[i]] : [...acc, e];
41
+ }, []);
42
+ }
41
43
  const links = hrefs.map((e, i) => (!i ? 'Home' : toTitleCase(e)));
42
44
  </script>
43
45
  <template>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.4",
2
+ "version": "0.1.5",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",