创建一个新的vue项目

一,安装vue脚手架(vue-cli)

npm install -g @vue/cli

二,检查脚手架是否安装成功

vue -V

三,创建项目vue create '项目名称'

vue create hello-vue
  1. 选择Manually select features(手动配置选项)
    1. Vue CLI v5.0.6
      ? Please pick a preset: Manually select features
      ? Check the features needed for your project: (Press <space> to select, <a> to
      toggle all, <i> to invert selection, and <enter> to proceed)
      >(*) Babel    //es6->es5
       ( ) TypeScript    //js超集
       ( ) Progressive Web App (PWA) Support    //渐进式web
       (*) Router  //路由
       (*) Vuex  //状态管理器
       (*) CSS Pre-processors    //css预处理器
       ( ) Linter / Formatter    //是否采用eslint规范
       ( ) Unit Testing    //测试
       ( ) E2E Testing    //测试
      
      

      采用上下键选择,采用空格键选择该项

    2. Vue CLI v5.0.6
      ? Please pick a preset: Manually select features
      ? Check the features needed for your project: Babel, Router, Vuex, CSS
      Pre-processors
      ? Choose a version of Vue.js that you want to start the project with (Use arrow
      keys)
      > 3.x    //vue 3.0
        2.x    //vue 2.0
      
      

  2. 是否使用history模式路由,根据个人需求(y/n)
? Use history mode for router? (Requires proper server setup for index fallback
in production) (Y/n)    //是否使用history模式
  1. Css/scss/sass预处理(根据个人需求)
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported
by default): (Use arrow keys)
> Sass/SCSS (with dart-sass)
  Less
  Stylus

2.配置文件存放格式

? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
> In dedicated config files    //单独文件存放(推荐)
  In package.json    //存放在package.json文件中

最后项目创建成功,根据提示执行

cd hello-vue    //返回到项目文件夹下

npm run serve    //启动项目

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值