cec-nuxt-lib 0.1.3 → 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,15 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useState } from '#app';
|
|
3
|
+
import { useRuntimeConfig } from '#app';
|
|
3
4
|
import { useRoute } from 'vue-router';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const config = useRuntimeConfig();
|
|
6
7
|
const route = useRoute();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const truePath =
|
|
10
|
-
route.path === '/' ? classicPath.value : classicPath.value + route.path;
|
|
11
|
-
let routes = route.path.split('/');
|
|
8
|
+
const classicPath = useState('classicPath');
|
|
9
|
+
const baseUrl = config.app.baseURL;
|
|
12
10
|
|
|
11
|
+
// Helper functions
|
|
13
12
|
const makeLink = (i) => {
|
|
14
13
|
let diff = i - length;
|
|
15
14
|
if (!diff) {
|
|
@@ -28,8 +27,20 @@ const toTitleCase = (str) => {
|
|
|
28
27
|
);
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
}
|
|
43
|
+
const links = hrefs.map((e, i) => (!i ? 'Home' : toTitleCase(e)));
|
|
33
44
|
</script>
|
|
34
45
|
<template>
|
|
35
46
|
<div class="cec-breadcrumb-bg">
|
package/package.json
CHANGED