cec-nuxt-lib 0.0.8 → 0.1.0
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,12 +1,28 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useState } from '#app';
|
|
3
|
-
|
|
3
|
+
import { useRoute } from 'vue-router';
|
|
4
|
+
|
|
5
|
+
const classicPath = useState('classicPath');
|
|
6
|
+
const route = useRoute();
|
|
7
|
+
let length = classicPath.value.split('/').length - 1;
|
|
8
|
+
|
|
9
|
+
const truePath =
|
|
10
|
+
route.path === '/' ? classicPath.value : classicPath.value + route.path;
|
|
11
|
+
let routes = route.path.split('/');
|
|
12
|
+
|
|
13
|
+
const makeLink = (i) => {
|
|
14
|
+
let diff = i - length;
|
|
15
|
+
if (!diff) {
|
|
16
|
+
return '/';
|
|
17
|
+
}
|
|
18
|
+
return routes.slice(0, diff + 1).join('/');
|
|
19
|
+
};
|
|
4
20
|
|
|
5
21
|
const toTitleCase = (str) => {
|
|
6
|
-
return str[0].toUpperCase() + str.slice(1).replace(
|
|
22
|
+
return str[0].toUpperCase() + str.slice(1).replace(/[-_]/g, ' ');
|
|
7
23
|
};
|
|
8
24
|
|
|
9
|
-
let hrefs =
|
|
25
|
+
let hrefs = truePath === '/' ? [''] : truePath.split('/');
|
|
10
26
|
const links = hrefs.map((e, i) => (!e ? 'Home' : toTitleCase(e)));
|
|
11
27
|
</script>
|
|
12
28
|
<template>
|
|
@@ -18,6 +34,9 @@ const links = hrefs.map((e, i) => (!e ? 'Home' : toTitleCase(e)));
|
|
|
18
34
|
<ol class="breadcrumb cec-breadcrumb my-0 py-2">
|
|
19
35
|
<li class="breadcrumb-item" v-for="(l, i) in links" :key="i">
|
|
20
36
|
<span v-if="i === links.length - 1">{{ l }}</span>
|
|
37
|
+
<NuxtLink v-else-if="i >= length" :to="makeLink(i)">
|
|
38
|
+
{{ l }}</NuxtLink
|
|
39
|
+
>
|
|
21
40
|
<a v-else :href="'/' + hrefs.slice(1, i + 1).join('/')">
|
|
22
41
|
{{ l }}</a
|
|
23
42
|
>
|
|
@@ -102,6 +102,7 @@ onMounted(() => {
|
|
|
102
102
|
} else {
|
|
103
103
|
x.innerText = 'Listen and translate';
|
|
104
104
|
}
|
|
105
|
+
BrowseAloud.panel.toggleBar();
|
|
105
106
|
};
|
|
106
107
|
|
|
107
108
|
try {
|
|
@@ -158,7 +159,7 @@ onMounted(() => {
|
|
|
158
159
|
<div class="ba_listenTranslateToggle d-inline">
|
|
159
160
|
<a
|
|
160
161
|
class="nav-link pe-0 d-inline ps-0"
|
|
161
|
-
|
|
162
|
+
@click="updateToggleText()"
|
|
162
163
|
href="#"
|
|
163
164
|
>
|
|
164
165
|
<i role="img" aria-label="Listen">
|
package/package.json
CHANGED