【Vue | initial】 创建初始化项目

chuang'jian'chu创建初始化

1. 使用命令创建

官方官网快速上手

cmd 复制代码
npm create vite@latest 

This command will install and execute create-vue, the official Vue project scaffolding tool. You will be presented with prompts for several optional features such as TypeScript and testing support:

  • 询问是否继续 ;请填写项目名
  • 是否要添加 ts (typescript)
  • 选择其他依赖
  • 跳过
  • 是否选择示例代码

初始化完成

因此,我们可以采用"架构师视角" 较为自动化的初始化

架构师视角

cmd 复制代码
# 架构师写在公司自动化脚本里的命令,瞬间生成标准项目
 npm create vue@latest my-company-project -- --ts --router --pinia --eslint --prettier

2. 进入创建的目录中,安装依赖(基础依赖)

Once the project is created, follow the instructions to install dependencies and start the dev server:

cmd 复制代码
cd <your-project-name>
npm install
npm run dev

粗心粗心???

基础依赖 npm install 是根据这个文件进行执行安装的package.json

You should now have your first Vue project running!

3. 安装"全家桶"依赖

安装"全家桶"依赖 npm install axios element-plus @element-plus/icons-vue

4.安装并配置 Tailwind CSS V4

npm install tailwindcss @tailwindcss/vite

5. 配置 vite.config.ts

typescript 复制代码
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'

import tailwindcss from '@tailwindcss/vite'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),  // register the plugin
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
})
相关推荐
九酒8 分钟前
AI Agent 开发踩坑记:口播功能非得用 APP 原生实现吗?
前端·人工智能·agent
Jackson__1 小时前
做了一段时间的AI coding后,我终于搞清了 CLI 和 MCP 的区别
前端·agent·ai编程
IT_陈寒3 小时前
JavaScript项目实战经验分享
前端·人工智能·后端
用户47949283569154 小时前
6w star,GitHub 趋势第一的 Ponytail,这个agent插件到底在火什么
前端·后端
薛定喵的谔5 小时前
我开源了一个精致的 Next.js 博客模板:Skyplume
前端·前端框架·next.js
张龙6876 小时前
构建生产级 AI Agent:工具调用与记忆架构实战指南
前端
kyriewen7 小时前
2026 年了,还在用 Node.js?Bun 迁移实战:20 分钟搞定,附踩坑记录
前端·javascript·node.js
青山Coding9 小时前
Cesium应用(八):物体运动的实现思路
前端·cesium
用户41659673693559 小时前
Android WebView 加载 file:// 离线页面调试教程
android·前端
Asmewill9 小时前
curl命令学习笔记一
前端