@hostlink/nuxt-light 0.0.41 → 0.0.43

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": "0.0.41"
4
+ "version": "0.0.43"
5
5
  }
@@ -1,11 +1,10 @@
1
1
  <script setup>
2
- const props = defineProps(["label"]);
3
-
2
+ defineProps(["label"]);
4
3
  </script>
5
4
  <template>
6
5
  <q-item>
7
6
  <q-item-section>
8
- <q-item-label>{{ props.label }}</q-item-label>
7
+ <q-item-label>{{ $t(label) }}</q-item-label>
9
8
  </q-item-section>
10
9
  <q-item-section side>
11
10
  <q-item-label><slot></slot></q-item-label>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { useSlots, computed } from 'vue';
2
+ import { useSlots, computed, ref } from 'vue';
3
3
 
4
4
  const props = defineProps(["modelValue"])
5
5
  const emit = defineEmits(["update:modelValue"])
@@ -7,24 +7,35 @@ const slots = useSlots();
7
7
  const defaultSlots = slots.default();
8
8
 
9
9
  //get the tabs from the default slot
10
+ let name = 0;
10
11
  const tabContents = defaultSlots.map((slot) => {
12
+ const n = slot.props.name || name++;
11
13
  return {
12
14
  label: slot.props.label,
13
15
  content: slot.children,
14
- name: slot.props.name
16
+ name: n.toString()
15
17
  }
16
18
  })
17
19
 
20
+ const v = ref(null)
21
+
22
+ if (tabContents.length > 0) {
23
+ v.value = tabContents[0].name
24
+ }
18
25
  const localValue = computed({
19
- get: () => props.modelValue,
20
- set: (val) => emit("update:modelValue", val)
26
+ get: () => props.modelValue || v.value,
27
+ set: (val) => {
28
+ v.value = val
29
+ emit("update:modelValue", val)
30
+ }
21
31
  })
32
+
22
33
  </script>
23
34
 
24
35
  <template>
25
36
  <l-card>
26
37
  <q-tabs class="text-grey" active-color="primary" indicator-color="primary" align="justify" v-model="localValue">
27
- <q-tab v-for="tab in tabContents" :label="tab.label" :name="tab.name"></q-tab>
38
+ <q-tab v-for="tab in tabContents" :label="$t(tab.label)" :name="tab.name"></q-tab>
28
39
  </q-tabs>
29
40
  <q-tab-panels v-model="localValue">
30
41
  <q-tab-panel v-for="tab in tabContents" :name="tab.name">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",