Vue 与 React 生态常用依赖提要
以下为常见选型参考,非必选;优先用脚手架(如 npm create vite@latest)生成最小依赖集,再按需叠加。
Vue
| 类别 | 常用包 |
|---|---|
| 核心 | vue、vue-router、pinia(新项目);维护项目可见 vuex |
| UI(中后台) | element-plus、ant-design-vue、naive-ui |
| UI(移动) | vant;跨端 uni-ui(uni-app) |
| 请求 | axios、ky |
| 工具 | lodash-es、dayjs、@vueuse/core |
| 图表 / i18n | echarts / vue-echarts、vue-i18n |
| 工程 | eslint + eslint-plugin-vue、prettier、husky、typescript、vite |
组合示例: 基础 vue + router + pinia + axios;后台加 Element/Ant + echarts;移动端 vant + vueuse。
React
| 类别 | 常用包 |
|---|---|
| 核心 | react、react-dom |
| 路由 | react-router-dom |
| 状态 | zustand、@reduxjs/toolkit、jotai |
| UI | antd、@mui/material、chakra-ui |
| 样式 | tailwindcss(配 PostCSS 等) |
| 请求 / 服务端状态 | axios、@tanstack/react-query、swr |
| 表单 | react-hook-form;复杂可用 formik + yup |
| 工具 | lodash、date-fns、classnames |
| 工程 | eslint-plugin-react、eslint-plugin-react-hooks、prettier、husky |
接口多、缓存复杂时,TanStack Query / SWR 能减少样板代码。
两栈共用
typescript、vite / webpack、rollup、eslint、prettier、lint-staged。
