up
chenyc
2022-09-09 cf29ab5abf6c5f7b870c4854d37cdd6ec69fda67
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
29
30
31
<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()
    const data={
        name:'cheng',
        age:18
    }
    // counter.count++
    const count=computed(()=>{
        return counter.count
    })
    const add=()=>{
        counter.increment()
    }
    onMounted(() => {
        console.log('初始化')
        console.log(router.query)
    })
 
</script>
 
<template>
    <Button @click="add" type="primary">
        Tertiary{{count}}
    </Button>
    <div>{{data.name}}</div>
</template>