@viur/shop-components 0.0.1-dev.17 → 0.0.1-dev.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viur/shop-components",
3
- "version": "0.0.1-dev.17",
3
+ "version": "0.0.1-dev.19",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,10 @@
1
1
  <template>
2
- <pre> {{ state.nodes }}</pre>
3
- <pre> {{ state.leaves }}</pre>
2
+ <Loader v-if="!cartKey.length"></Loader>
3
+ <template v-else>
4
+ <pre> {{ state.nodes }}</pre>
5
+ <pre> {{ state.leaves }}</pre>
6
+ </template>
7
+
4
8
  <!-- <CartNode></CartNode>
5
9
  <CartLeaf></CartLeaf> -->
6
10
  <!-- <template v-else>
@@ -314,9 +318,9 @@ function onDialogHide() {
314
318
  }
315
319
 
316
320
  async function getChildren(parentKey = props.key) {
317
- console.log("debug getChildren parentKey from comp: ", parentKey)
321
+ console.log("debug getChildren parentKey from comp: ", parentKey);
318
322
  const children = await cartStore.getChildren(parentKey);
319
- console.log("getChildren children: ", children)
323
+ console.log("getChildren children: ", children);
320
324
 
321
325
  children.forEach(async (child) => {
322
326
  if (child.skel_type === "node") {
@@ -3,7 +3,7 @@
3
3
  </template>
4
4
 
5
5
  <script setup>
6
- import { onBeforeMount, reactive, shallowRef } from "vue";
6
+ import { onBeforeMount, reactive, shallowRef, computed } from "vue";
7
7
  import { ListRequest } from "@viur/vue-utils";
8
8
 
9
9
  import CartView from "../../cart/CartView.vue";
@@ -17,6 +17,9 @@ import { useCartStore } from "../../../stores/cart";
17
17
 
18
18
  const cartStore = useCartStore();
19
19
 
20
+ const rootNode = computed(() =>
21
+ cartStore.state.basketRootNode.key ? cartStore.state.basketRootNode.key : "",
22
+ );
20
23
  const state = reactive({
21
24
  rootNode: {},
22
25
  tabs: {
@@ -25,7 +28,7 @@ const state = reactive({
25
28
  props: {
26
29
  sidebar: true,
27
30
  mode: "basket",
28
- cartKey: state.rootNode.key,
31
+ cartKey: rootNode,
29
32
  }, // cartKey (on initial call has to be a root node) is a required prop, make sure that cartStore.init() is called before cart is mounted
30
33
  displayName: "Warenkorb",
31
34
  icon: { name: "cart", library: "hsk" },
@@ -101,7 +104,8 @@ function handleTabs(e) {
101
104
 
102
105
  onBeforeMount(async () => {
103
106
  await cartStore.init();
104
- state.rootNode = cartStore.state.basketRootNode.key
105
107
  await cartStore.getAdressStructure();
108
+
109
+ console.log("debug init exampleusage :", cartStore.state.basketRootNode);
106
110
  });
107
111
  </script>