--- /dev/null
+<template>
+ <p>Counter :{{ counterStore.n }}</p>
+
+ <button @click="counterStore.increment">Increment</button>
+ <button @click="counterStore.n++">Direct Increment</button>
+ <button
+ @click="
+ counterStore.$patch((state) => {
+ state.n++
+ state.incrementedTimes++
+ })
+ "
+ >
+ Direct patch
+ </button>
+ <button @click="counterStore.fail">Fail</button>
+ <button @click="counterStore.decrementToZero(300, true)">To ZERO</button>
+</template>
+
+<script setup>
+import { useCartStore } from '../stores/cart'
+import { useCounter } from '../stores/counter'
+
+const counterStore = useCounter()
+const cartStore = useCartStore()
+</script>
-<template>I have a store "{{ userStore.name }}"</template>
+<template>
+ <p>
+ I have a store "{{ userStore.name }}". I have
+ {{ cartStore.items.length }} items in the cart.
+ </p>
+</template>
<script setup lang="ts">
import { useUserStore } from '../stores/user'
+import { useCartStore } from '../stores/cart'
const userStore = useUserStore()
+const cartStore = useCartStore()
</script>
<path d="M15 2.005h2v5h-2z" fill="currentColor"></path>
</svg>
</button>
-
- <p>Counter :{{ counterStore.n }}</p>
-
- <button @click="counterStore.increment">Increment</button>
- <button @click="counterStore.n++">Direct Increment</button>
- <button
- @click="
- counterStore.$patch((state) => {
- state.n++
- state.incrementedTimes++
- })
- "
- >
- Direct patch
- </button>
- <button @click="counterStore.fail">Fail</button>
- <button @click="counterStore.decrementToZero(300, true)">To ZERO</button>
</template>
<script setup lang="ts">
import { computed, onMounted, ref, watchEffect } from 'vue'
-import { useCartStore } from '../stores/cart'
-import { useCounter } from '../stores/counter'
const isBrowser = typeof window !== 'undefined'
return !window.matchMedia(PREFERS_LIGHT).matches
}
-const counterStore = useCounter()
-const cartStore = useCartStore()
-
const storageKey = 'pinia-color-scheme'
const localIsDark = ref(isDarkMode())
import Theme from 'vitepress/theme'
import './custom.css'
import './code-theme.css'
-import { createPinia } from '../../../src'
+// import { createPinia } from '../../../src'
const { Layout } = Theme
const config = {
...Theme,
enhanceApp({ app }) {
- app.use(createPinia())
+ // app.use(createPinia())
},
}
---
<ThemeToggle/>
-<TestStore/>
+<!-- <TestStore/> -->
<HomeSponsors />
<script setup>
import HomeSponsors from './.vitepress/components/HomeSponsors.vue'
import ThemeToggle from './.vitepress/components/ThemeToggle.vue'
-import TestStore from './.vitepress/components/TestStore.vue'
+// import TestStore from './.vitepress/components/TestStore.vue'
</script>