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
|
| import { defineStore } from 'pinia'
| import { ref } from 'vue'
| // 使用示例一:函数式定义【个人推荐】
| export const userInfoStore = defineStore('userInfo', () => {
| const info = ref({
| openid:'',
| headimgurl:'',
| nickname:'',
| })
| // const patient=ref({
| // patientName:'',
| // patientTelNo:'',
| // id:0,
| // code:'',
| // })
| function setInfo(userInfo:{openid:string, headimgurl:string,nickname:string}) {
| info.value.openid=userInfo.openid
| info.value.headimgurl=userInfo.headimgurl
| info.value.nickname=userInfo.nickname
| }
| // function setUser(userInfo:{openid:string, headimgurl:string,nickname:string}) {
| // info.value.openid=userInfo.openid
| // info.value.headimgurl=userInfo.headimgurl
| // info.value.nickname=userInfo.nickname
| // }
|
| return { info, setInfo }
| })
|
|