From 94670eed7d9bd56f1a87b3031240a87129b12598 Mon Sep 17 00:00:00 2001 From: lhj <403133128@qq.com> Date: Wed, 2 Oct 2024 17:11:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0scheme=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TestComponent.vue | 10 ++++++++++ src/stores/useSchemeStore.ts | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) 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