You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
604 B
26 lines
604 B
4 months ago
|
//创建用户相关的小仓库
|
||
|
import { defineStore } from 'pinia'
|
||
|
//引入登录接口
|
||
|
import { reqLogin } from '@/api/user'
|
||
|
//引入数据类型
|
||
|
import type { loginForm } from '@/api/user/type'
|
||
|
//创建小仓库
|
||
|
let useUserStore = defineStore('User', {
|
||
|
//小仓库存储数据的地方
|
||
|
state: () => {},
|
||
|
//异步|逻辑的地方
|
||
|
actions: {
|
||
|
//用户登录方法
|
||
|
//括号内data收集参数(实参)
|
||
|
async userLogin(data: loginForm) {
|
||
|
//登录请求
|
||
|
let result = await reqLogin(data)
|
||
|
console.log(result)
|
||
|
},
|
||
|
},
|
||
|
getters: {
|
||
|
|
||
|
},
|
||
|
})
|
||
|
export default useUserStore
|