diff --git a/src/components/TestComponent.vue b/src/components/TestComponent.vue index ad40d48..6aa7168 100644 --- a/src/components/TestComponent.vue +++ b/src/components/TestComponent.vue @@ -8,11 +8,21 @@ function add() { function sub() { store.decrement() } + +function initSchema() +{ + store.initSchema({ + name:"test" + }) +} \ No newline at end of file diff --git a/src/stores/useSchemeStore.ts b/src/stores/useSchemeStore.ts index a96f16a..12f94fe 100644 --- a/src/stores/useSchemeStore.ts +++ b/src/stores/useSchemeStore.ts @@ -4,7 +4,7 @@ import { ref,computed } from 'vue'; export const useCounterStore = defineStore('counter', () => { const count = ref(0) - const schema=ref() + const scheme=ref() const doubleCount = computed(() => count.value * 2) function increment() { count.value++ @@ -12,6 +12,10 @@ export const useCounterStore = defineStore('counter', () => { function decrement() { count.value-- } + function initSchema(value) + { + scheme.value=value + } - return { count,schema, doubleCount, increment,decrement } + return { count,scheme, doubleCount, increment,decrement,initSchema } }) \ No newline at end of file