diff --git a/README.md b/README.md index 1511959c22b74118c06679739cf9abe2ceeea48c..8960712ffad06587841f7e1701440360afa85f7c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,331 @@ -# Vue 3 + Vite +# CSGO 管理后台 -This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 ` +``` + +### API 请求示例 + +```javascript +// src/api/modules/user.js +import { request } from '../request' + +export const getUserList = (params) => { + return request.get('/api/users', { params }) +} + +export const login = (data) => { + return request.post('/api/login', data) +} +``` + +### 状态管理示例 + +```javascript +// src/store/modules/user.js +import { defineStore } from 'pinia' + +export const useUserStore = defineStore('user', { + state: () => ({ + userInfo: null, + token: '' + }), + + actions: { + setUserInfo(info) { + this.userInfo = info + }, + setToken(token) { + this.token = token + } + } +}) +``` + +### 使用 Store + +```vue + +``` + +--- + +## 常用命令 + +| 命令 | 说明 | +|------|------| +| `npm run dev` | 启动开发服务器 | +| `npm run build` | 构建生产版本 | +| `npm run preview` | 预览生产构建 | + +--- + +## 相关文档 + +- [Vue 3 官方文档](https://cn.vuejs.org/) +- [Vite 官方文档](https://vitejs.dev/) +- [PrimeVue 官方文档](https://primevue.org/) +- [PrimeIcons 图标库](https://primeicons.org/) +- [Tailwind CSS 官方文档](https://tailwindcss.com/docs) +- [Vue Router 文档](https://router.vuejs.org/zh/) +- [Pinia 文档](https://pinia.vuejs.org/zh/) +- [Axios 文档](https://axios-http.com/docs/intro) + +--- + +## 许可证 + +MIT License \ No newline at end of file