# 1. 创建 Vue3.0+TypeScript+Vite 网页端项目
npm init vite@latest |
一般创建好了之后,进行组件库 + Vue-Router+Pinia 三件套的安装。
# 2. 在创建好的 Vue3.0+TypeScript+Vite 网页端项目中导入 Element-PlusUI 组件库
在控制台执行命令:
# --save 参数的作用是将安装的包信息保存到 package.json 文件中的 dependencies 字段中 | |
npm install element-plus --save |
安装完成后,在 main.ts 里面导入并注册 Element-Plus 组件库:
// main.ts | |
import { createApp } from "vue"; | |
import ElementPlus from "element-plus"; | |
import "element-plus/dist/index.css"; | |
import App from "./App.vue"; | |
const app = createApp(App); | |
app.use(ElementPlus); | |
app.mount("#app"); |
在 tsconfig.ts 中进行 Volar 支持的引入:
// tsconfig.json | |
{ | |
"compilerOptions": { | |
// ... | |
"types": ["element-plus/global"] | |
} | |
} |
# 3. 创建 Express 后端项目
# 全局安装 express 框架启动器 | |
npm install -g express-generator | |
# 运行启动器创建一个 express 项目 | |
express '项目名称' |
# 4. 创建 Uniapp+Vue3.0+TS 项目
npx degit dcloudio/uni-preset-vue#vite-ts uniapp |
# 5. 创建 Uniapp+Vue3.0+TS+TMUI 项目
tmui use cli |
# 6. 创建 nest 项目
全局安装 nest.js,创建项目
npm install -g @nestjs/cli | |
nest new 项目名 |
只在当前项目中使用 nest.js 创建项目
npx @nestjs/cli new 项目名 |
# 7. 切换 node 版本
使用 nvm 这个工具进行管理
# 查看可用的 node 版本列表 | |
nvm list | |
# 切换指定的 node 版本 | |
nvm use 16.18.0 |
# 8. npm/pnpm 相关命令
-
查看
npm
当前版本npm -v
-
清理
npm
缓存数据npm cache clean --force
-
更新到最新版本
npm install -g npm
-
更新到指定版本
npm -g install npm@6.8.0
或者
npm i npm@6 -g
-
升级 pnpm 版本
npm install pnpm@latest -g
# 9. 创建 React 项目相关命令
# 创建最基本的 JS+webpack 项目
npx create-react-app <react-app-name> |
# 创建 TS+webpack 项目
npx create-react-app <react-app-name> --template typescript |
# 创建 TS+Vite 项目
npm create vite@latest <react-app-name> --template react-ts |