uo
chenyc
2022-09-09 a939b60c9819df65c4eb59fb3164e5ad179ae854
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
32
33
34
35
36
37
38
39
<script lang="ts" setup>
    import { onMounted,computed } from 'vue'
    import { ajaxPost } from '@/utils/axios'
    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('初始化',router)
        const queryInfo=router.query
        const {code}=queryInfo
        if (code){
            ajaxPost('wechat/code',`code=${code}`).then((re:any)=>{
                console.log(re)
            })
        }
        console.log(code)
    })
 
</script>
 
<template>
    <Button @click="add" type="primary">
        Tertiary{{count}}
    </Button>
    <div>{{data.name}}</div>
</template>