HTTP请求
pnpm add axios@latest
{
"dependencies": {
"axios": "^0.26.1",
"throttle-debounce": "^3.0.1",
}
}
2025/12/25大约 2 分钟
pnpm add axios@latest
{
"dependencies": {
"axios": "^0.26.1",
"throttle-debounce": "^3.0.1",
}
}
本教程是基于vite8,使用vue官方初始模板,逐步搭建一个完整的中后台管理系统框架。
cd E:/project/
# 使用create-vue创建项目
# pnpm create vue@latest -- --help # 帮助文档
pnpm create vue@latest vue-admin-template
pnpm add -D vite@8.0.0-beta.5 # 更新vite为8版本。 (`-D`安装到开发依赖区域)
cd vue-admin-template
pnpm install
2小时带你掌握“Monorepo”
vue-vben-admin GitHub
ts-monorepo GitHub
expo-monorepo-example GitHub
npx degit antfu-collective/vitesse-lite my-vitesse-app
cd my-vitesse-app
pnpm install
npx tiged vue-zone/vue3-vant-mobile my-mobile-app
cd my-mobile-app
pnpm install
https://cn.vuejs.org/guide/scaling-up/tooling.html
使用命令行创建项目:pnpm create vue@latest
一个基本的vue项目包:
{
"scripts": {
"dev": "vite",
"build": "vue-tsc --build && vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.5.25"
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.2",
"vite": "^7.2.4",
"vite-plugin-vue-devtools": "^8.0.5"
}
}
# --- 创建npm项目 ---
mkdir demo-vite ; cd demo-vite
pnpm init # 初始化一个包
# --- 创建vite项目 ---
pnpm add -D vite@v8.0.0-beta.4
vim package.json
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite previeww"
},
# vite是浏览器优先,vite的入口文件是 index.html
touch index.html
<html>
<body>
<script type="module" src="./src/main.ts"></script>
</body>
</html>
touch src/main.ts
console.log("hello world");
# 搭建完成,启动vite项目
pnpm build
pnpm dev
https://www.postgresql.org/download/linux/ubuntu/
# 添加PostgreSQL官方仓库
apt install -y postgresql-common ca-certificates
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
# 安装
sudo apt update
sudo apt install postgresql-18
# 配置
su postgres
cd /etc/postgresql/18/main
# 用户级别权限和连接配置
vim pg_hba.conf
host all all 0.0.0.0/0 scra-sha-256
# 服务级别的配置
vim postgresql.conf
listen_address = '*'
port 15432
systemctl enable postgresql
systemctl start postgresql
# 进入终端
su postgres
psql
\list # 查看数据库
\dn # 查看当前数据的架构和拥有者
\du; # 查看全部用户
\help alter # 查看alter命令文档
alter user postgres with password '123456'; # 给postgres用户设置密码
# 创建超级管理员
create user root with superuser password '123456'; # 创建一个root超级管理员用户
create database root; # 创建root数据库
# 创建普通用户(同时也可以给创建数据库权限)
create user demo with password '123456' CREATEDB;
create database demo_db owner demo;
\c demo_db; # 切换数据库
由于官方没有SQLModel异步文档,FastAPI的生态还无法很好稳定的使用。
FastAPI官方文档:FastAPI
FastAPI项目模板:full-stack-fastapi-template GitHub
awesome-fastapi: awesome-fastapi
FastAPI规范:fastapi-best-practices
View官方快速上手文档:点击查看
drf中,过滤、搜索、排序都叫filter
过滤器官方文档:drf官方文档 django-filter文档