添加scheme测试代码
This commit is contained in:
@ -8,11 +8,21 @@ function add() {
|
|||||||
function sub() {
|
function sub() {
|
||||||
store.decrement()
|
store.decrement()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initSchema()
|
||||||
|
{
|
||||||
|
store.initSchema({
|
||||||
|
name:"test"
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>{{ store.count }}</div>
|
<div>{{ store.count }}</div>
|
||||||
<a-button @click=add>add</a-button>
|
<a-button @click=add>add</a-button>
|
||||||
<a-button @click=sub>sub</a-button>
|
<a-button @click=sub>sub</a-button>
|
||||||
|
<div>{{ store.schema }}</div>
|
||||||
|
<a-button @click=initSchema>initSchema</a-button>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -4,7 +4,7 @@ import { ref,computed } from 'vue';
|
|||||||
|
|
||||||
export const useCounterStore = defineStore('counter', () => {
|
export const useCounterStore = defineStore('counter', () => {
|
||||||
const count = ref(0)
|
const count = ref(0)
|
||||||
const schema=ref<IPageComponent>()
|
const scheme=ref<IPageComponent>()
|
||||||
const doubleCount = computed(() => count.value * 2)
|
const doubleCount = computed(() => count.value * 2)
|
||||||
function increment() {
|
function increment() {
|
||||||
count.value++
|
count.value++
|
||||||
@ -12,6 +12,10 @@ export const useCounterStore = defineStore('counter', () => {
|
|||||||
function decrement() {
|
function decrement() {
|
||||||
count.value--
|
count.value--
|
||||||
}
|
}
|
||||||
|
function initSchema(value)
|
||||||
|
{
|
||||||
|
scheme.value=value
|
||||||
|
}
|
||||||
|
|
||||||
return { count,schema, doubleCount, increment,decrement }
|
return { count,scheme, doubleCount, increment,decrement,initSchema }
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user