【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))
    },
  },
})
相关推荐
KaMeidebaby2 小时前
卡梅德生物技术快报|PD1 单克隆抗体定制配套 N 糖全谱质控开发
前端·人工智能·算法·数据挖掘·数据分析
nuIl3 小时前
实现一个 Coding Agent(3):工具调用
前端·agent·cursor
nuIl3 小时前
实现一个 Coding Agent(4):ReAct 循环
前端·agent·cursor
nuIl3 小时前
实现一个 Coding Agent(1):一次 LLM 调用
前端·agent·cursor
nuIl3 小时前
实现一个 Coding Agent(2):让 LLM 流式响应
前端·agent·cursor
copyer_xyf3 小时前
Python 异常处理
前端·后端·python
sugar__salt3 小时前
从栈队列数据结构到JS原型面向对象全解
前端·javascript·数据结构
独特的螺狮粉3 小时前
篮球集训班器具管理系统 - 鸿蒙PC Electron框架完整技术实现指南
前端·javascript·华为·electron·前端框架·开源·鸿蒙
pusheng20253 小时前
IFSJ全英文专访:中国创新力量重塑先进气体感知技术,赋能全球关键基础设施安全
前端·网络·人工智能·物联网·安全
AI_零食4 小时前
番茄钟鸿蒙PC Electron框架完成:状态机、定时器管理与专注力工具设计
前端·javascript·华为·electron·开源·鸿蒙·鸿蒙系统