init pinia

This commit is contained in:
Antony Budianto
2025-01-03 17:37:54 +07:00
parent b0221e1d21
commit de425bd9e5
15 changed files with 241 additions and 34 deletions
+20 -7
View File
@@ -1,24 +1,37 @@
<template>
<div>
<component v-if="asyncPageComponent" :is="asyncPageComponent" />
<component
v-if="asyncPageComponent"
:is="asyncPageComponent"
@increment="(v: number) => emit('increment', v)"
/>
</div>
</template>
<script setup>
<script setup lang="ts">
import { defineAsyncComponent } from "vue"
import { useHostPinia } from "~/composables/useHostPinia"
const props = defineProps<{
label: string
}>()
const emit = defineEmits<{
(e: "increment", count: number): void
}>()
useHostPinia()
/**
* @todo
* it'll be nice if there is a way to dynamically match route and render..
*/
console.log(">>", window.location.pathname)
const Index = defineAsyncComponent(() => import("@/pages/contact/index.vue"))
const Properties = defineAsyncComponent(() =>
import("@/pages/contact/properties.vue")
const Properties = defineAsyncComponent(
() => import("@/pages/contact/properties.vue")
)
let asyncPageComponent
let asyncPageComponent: unknown
if (/\/contact\/properties/.test(window.location.pathname)) {
asyncPageComponent = Properties
} else {