【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))
    },
  },
})
相关推荐
超级无敌暴龙兽7 小时前
和我一起刷面试题呀
前端·面试
wzl202612137 小时前
企业微信定时群发技术实现与实操指南(原生接口+工具落地)
java·运维·前端·企业微信
小码哥_常7 小时前
Robots.txt:互联网爬虫世界的“隐形规则”
前端
小码哥_常8 小时前
Android开发神器:AndroidAutoSize,轻松搞定屏幕适配
前端
前端一小卒8 小时前
前端工程师的全栈焦虑,我用 60 天治好了
前端·javascript·后端
不停喝水8 小时前
【AI+Cursor】 告别切图仔,拥抱Vibe Coding: AI + Cursor 开启多模态全栈新纪元 (1)
前端·人工智能·后端·ai·ai编程·cursor
coderyi9 小时前
LLM Agent 浅析
前端·javascript·人工智能
科雷软件测试9 小时前
使用python+Midscene.js AI驱动打造企业级WEB自动化解决方案
前端·javascript·python
ConardLi10 小时前
把 Claude Design 做成 Skill,你的网站也能拥有顶级视觉体验
前端·人工智能·后端