【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))
    },
  },
})
相关推荐
咩咩啃树皮4 小时前
第40篇:Vue3组件化开发精讲——组件拆分、复用、父子通信、工程化架构
java·前端·架构
阳光是sunny4 小时前
LangGraph中的Reducer是什么
前端·人工智能·后端
触底反弹4 小时前
一文搞懂 Tailwind CSS 弹性布局:从原理到实战
前端·css·html
阳光是sunny4 小时前
从链到图:LangGraph 入门基础全解析
前端·人工智能·后端
小林ixn5 小时前
从 ??= 到 onKeyDown:一个 React 组件的“自我修养”
前端·javascript·react.js
REDcker5 小时前
显示分辨率标准对照详解
前端·网络·分辨率·显示·屏幕
এ慕ོ冬℘゜6 小时前
前端实战:jQuery 多条件联合搜索(标题模糊查询 + 日历时间段筛选)
前端·javascript·jquery
武子康6 小时前
Search Console Platform Properties 扩大 SEO 资产边界:从 Page Ranking 到 Topic Coverage(5 类误读边界 + 3 表数据层设计)
前端·人工智能·后端
一点一木7 小时前
从60首歌到1个网站:输入你的故事,还你一首歌
前端·github
IT_陈寒8 小时前
Vue这个特性差点让我加班到凌晨,谁懂啊
前端·人工智能·后端