chenyc
2022-09-08 f611789518e4977c211fe8b1e03cb2f8e627445a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script lang="ts" setup>
    import { onMounted,computed } from 'vue'
    import { useCounterStore } from '@/stores/counter'
    import { Button  } from 'vant'
    import {useRoute} from 'vue-router'
    const router = useRoute()
    const counter = useCounterStore()
 
    // counter.count++
    const count=computed(()=>{
        return counter.count
    })
    console.log(count, 'count')
    const add=()=>{
        counter.increment()
    }
    onMounted(() => {
        console.log('初始化')
        console.log(router.query)
    })
 
</script>
 
<template>
    <Button @click="add" type="primary">
        Tertiary{{count}}
    </Button>
</template>