vue项目创建三种方式 (初学推荐)

方式一

使用power shell 创建

​ 新建文件夹 ---------- 地址栏输入 powershell

使用cmd 创建

​ 新建文件夹 ---------- 地址栏输入 cmd

vue init webpack demo_name
Project name demo_name   -------------- 项目名称 Enter
Project description (A Vue.js project)   -------------- 项目描述 Enter
Author 小童 <2207296489@qq.com> ------------- 项目作者 Enter
Vue build standalone -------------- 项目模式 Enter
Install vue-router? ------------- 安装vue-router Y
se ESLint to lint your code? -------------安装eslint 随便,安装后格式总是爆红 N
Set up unit tests --------------不懂 N
Setup e2e tests with Nightwatch? --------------不懂 N
Should we run `npm install` for you after the project has been created? (recommended)
> Yes, use NPM   
  Yes, use Yarn  
  No, I will handle that myself  
cd demo_name --------------  进入项目目录
----------------- 运行命令运行项目
tip:
1.用npm后就npm run dev 运行
2.用yarn后用yarn serve运行前需要先运行yarn add serve一下
3.到项目里面自行安装npm install ------ npm install -g yarn

方式二

使用power shell 创建

使用cmd 创建

1.vue create demo_create
2.? Please pick a preset: (Use arrow keys)
  > Default ([Vue 2] babel, eslint) ------------ 默认vue2 + eslint
    Default (Vue 3) ([Vue 3] babel, eslint) ------------ 默认vue3 + eslint
    Manually select features ------------ 手动选择(就这个了)
3. > (*) Choose Vue version  ----------- 空格选择这些 ------------Enter
     (*) Babel
     ( ) TypeScript
     ( ) Progressive Web App (PWA) Support
     (*) Router
     (*) Vuex
     (*) CSS Pre-processors
     (*) Linter / Formatter
     ( ) Unit Testing
     ( ) E2E Testing
4.Choose a version of Vue.js that you want to start the project with (Use arrow keys)
    > 2.x ------------- vue版本,看你需要了 -------- Enter
      3.x
5. Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) --------- 路由模式 是否用history (区分下history 和 hash: history 会次次访问后台接口,hash不会,他自己页面跳转)------ N ------ Enter
6. Sass/SCSS (with dart-sass)
  Sass/SCSS (with node-sass)
  Less  -------------- 不懂就选 Less -------Enter
  Stylus
7. ESLint with error prevention only
  ESLint + Airbnb config
  ESLint + Standard config -------- 代码校验选项 选这个 -------- Enter
  ESLint + Prettier
8. Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection) ----- 啥时候触发代码校验 --- 随便选,也可都选
  >(*) Lint on save 
   (*) Lint and fix on commit
9.Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys) --------- 配置类放哪
  > In dedicated config files  ------- 独立文件 ------选这个 ------- Enter
    In package.json ------- 写这里一起
10.Save this as a preset for future projects? (y/N) -----是否保存以上的配置--Y
11.Save preset as: vue_demo ------- 取个配置名
12.Pick the package manager to use when installing dependencies: (Use arrow keys)
  > Use Yarn ---------同上
    Use NPM
13.cd demo_create -------- cd 到你创建的目录
14.yarn serve -------- 启动项目

方式三

​ 用可视化工具(cmd 或 powershell)

vue ui就可打开可视化工具,然后自己琢磨

阅读终点,创作起航,您可以撰写心得或摘录文章要点写篇博文。去创作
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
创建一个Vue项目,你可以按照以下步骤进行操作: 1. 首先,确保你已经安装了Node.js。Node.js是运行JavaScript的环境,Vue项目需要依赖它来运行。 2. 安装Vue的命令行工具(CLI)。你可以使用以下命令来全局安装Vue CLI: ``` npm install -g @vue/cli ``` 3. 创建一个新的Vue项目。你可以使用以下命令来创建一个新的Vue项目: ``` vue create <项目名称> ``` 4. 在创建项目的过程中,你可以选择手动配置或者使用默认配置。如果你是初学者,建议选择默认配置。 5. 创建完成后,进入项目目录: ``` cd <项目名称> ``` 6. 启动项目。你可以使用以下命令来启动项目: ``` npm run serve ``` 这将会在本地启动一个开发服务器,并且会自动打开一个浏览器窗口来显示你的Vue应用。 通过以上步骤,你就可以成功创建一个Vue项目并在本地进行开发了。如果你想将项目部署到服务器上,可以使用`npm run build`命令来构建生产环境的代码。构建完成后,你可以将生成的文件部署到服务器上。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* [vue使用npm run build命令打包项目](https://blog.csdn.net/m0_74387152/article/details/127884550)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [『从零开始学vue』教你如何使用npm快速创建一个vue项目](https://blog.csdn.net/weixin_53463734/article/details/125230270)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Watson X

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值