cec-nuxt-lib 0.0.4 → 0.0.6
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,38 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useRoute } from 'vue-router';
|
|
3
2
|
import { useState } from '#app';
|
|
4
3
|
const path = useState('path');
|
|
5
|
-
const route = useRoute();
|
|
6
|
-
let length = path.value.split('/').length - 1;
|
|
7
|
-
const truePath = route.path === '/' ? path.value : path.value + route.path;
|
|
8
|
-
let routes = route.path.split('/');
|
|
9
|
-
|
|
10
|
-
const makeLink = (i) => {
|
|
11
|
-
let diff = i - length;
|
|
12
|
-
if (!diff) {
|
|
13
|
-
return '/';
|
|
14
|
-
}
|
|
15
|
-
return routes.slice(0, diff + 1).join('/');
|
|
16
|
-
};
|
|
17
4
|
|
|
18
5
|
const toTitleCase = (str) => {
|
|
19
|
-
return str
|
|
20
|
-
.split('_')
|
|
21
|
-
.map((w) => w[0].toUpperCase() + w.slice(1))
|
|
22
|
-
.join(' ');
|
|
6
|
+
return str[0].toUpperCase() + str.slice(1).replace(/-/g, ' ');
|
|
23
7
|
};
|
|
24
8
|
|
|
25
|
-
let hrefs =
|
|
26
|
-
const links = hrefs.map((e, i) =>
|
|
27
|
-
!e
|
|
28
|
-
? 'Home'
|
|
29
|
-
: truePath.includes('/parties/') && i === hrefs.length - 1
|
|
30
|
-
? toTitleCase(e)
|
|
31
|
-
: `${e[0].toUpperCase()}${e
|
|
32
|
-
.slice(1)
|
|
33
|
-
.replace(/[-_]/g, ' ')
|
|
34
|
-
.replace(/\shmo\s/, ' HMO ')}`
|
|
35
|
-
);
|
|
9
|
+
let hrefs = path.value === '/' ? [''] : path.value.split('/');
|
|
10
|
+
const links = hrefs.map((e, i) => (!e ? 'Home' : toTitleCase(e)));
|
|
36
11
|
</script>
|
|
37
12
|
<template>
|
|
38
13
|
<div class="cec-breadcrumb-bg">
|
|
@@ -43,10 +18,6 @@ const links = hrefs.map((e, i) =>
|
|
|
43
18
|
<ol class="breadcrumb cec-breadcrumb my-0 py-2">
|
|
44
19
|
<li class="breadcrumb-item" v-for="(l, i) in links" :key="i">
|
|
45
20
|
<span v-if="i === links.length - 1">{{ l }}</span>
|
|
46
|
-
<NuxtLink v-else-if="i >= length" :to="makeLink(i)">
|
|
47
|
-
{{ l }}</NuxtLink
|
|
48
|
-
>
|
|
49
|
-
<a v-else-if="!i" href="/">{{ l }}</a>
|
|
50
21
|
<a v-else :href="'/' + hrefs.slice(1, i + 1).join('/')">
|
|
51
22
|
{{ l }}</a
|
|
52
23
|
>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useState } from '#app';
|
|
3
|
+
const siblings = useState('siblings');
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<h2>In this section</h2>
|
|
8
|
+
<ul>
|
|
9
|
+
<li v-for="item in siblings">
|
|
10
|
+
<a :href="item.path">{{ item.displayName }}</a>
|
|
11
|
+
</li>
|
|
12
|
+
</ul>
|
|
13
|
+
</template>
|
package/package.json
CHANGED