从零搭建Vue3 + Typescript + Pinia + Vite + Tailwind CSS + Element Plus开发脚手架
warning:
这篇文章距离上次修改已过264天,其中的内容可能已经有所变动。
以下是搭建一个使用Vue 3、Typescript、Pinia、Vite、Tailwind CSS和Element Plus的项目的步骤:
- 确保你已经安装了Node.js和npm。
安装或升级Vue CLI到最新版本:
npm install -g @vue/cli
创建一个新的Vue 3项目:
vue create my-vue3-project
在提示选择预设时,选择“Manually select features”。然后选择“TypeScript”、“Progressive Web App (PWA) Support”、“Vue Router”、“Vuex”和“CSS Pre-processors”(确保选择Tailwind CSS)。
安装Pinia:
cd my-vue3-project vue add pinia
集成Vite:
npm uninstall vue-cli-service npm install vite
修改package.json中的scripts部分:
安装Tailwind CSS:
npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p
修改tailwind.config.js以包含正确的路径。
安装Element Plus:
npm install element-plus
在main.ts中引入Element Plus和Tailwind CSS:
运行项目:
npm run serve
这样,你就拥有了一个基于Vue 3、使用Typescript、Pinia、Vite、Tailwind CSS和Element Plus的开发脚本。
评论已关闭