@hostlink/nuxt-light 1.10.21 → 1.10.22

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": "light",
3
3
  "configKey": "light",
4
- "version": "1.10.21"
4
+ "version": "1.10.22"
5
5
  }
@@ -1,4 +1,5 @@
1
1
  <script setup>
2
+ import { useRoute } from 'vue-router'
2
3
  import { ref, computed } from 'vue'
3
4
  import { useLight } from '#imports'
4
5
  const props = defineProps(["value", "dense"])
@@ -24,6 +25,28 @@ const color2 = computed(() => {
24
25
 
25
26
  //generate a random group name
26
27
  const group = Math.random().toString(36).substring(7);
28
+
29
+ const route = useRoute();
30
+ const path = route.path
31
+ const hasLink = (item) => {
32
+ if (item.children) {
33
+ for (let i = 0; i < item.children.length; i++) {
34
+ if (hasLink(item.children[i])) {
35
+ return true;
36
+ }
37
+ }
38
+ }
39
+ if (item.to == path) {
40
+ return true;
41
+ }
42
+ return false;
43
+ }
44
+
45
+ const hasChildLink = () => {
46
+ return hasLink(props.value)
47
+ }
48
+
49
+
27
50
  </script>
28
51
 
29
52
  <style scoped>
@@ -33,7 +56,7 @@ const group = Math.random().toString(36).substring(7);
33
56
  <q-list class="menu-list" :dense="dense">
34
57
  <template v-for="menu in value">
35
58
 
36
- <q-expansion-item :label="$t(menu.label)" :icon="menu.icon" :dense="dense" v-if="isShowExpansionItem(menu)"
59
+ <q-expansion-item :default-opened="hasLink(menu)" :label="$t(menu.label)" :icon="menu.icon" :dense="dense" v-if="isShowExpansionItem(menu)"
37
60
  :group="group">
38
61
  <l-menu class="q-pl-md" :value="menu.children" :dense="dense"></l-menu>
39
62
  </q-expansion-item>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.10.21",
3
+ "version": "1.10.22",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",