Vue2.0创建一个新项目
一、安装脚手架
一切的一切都是需要提前安装好node哦,不会安装和配置的可以看:
Node初次安装配置&个人博客
Node初次安装配置&CSDN
win+R输入cmd 打开终端
// 在终端输入
npm install -g @vue/cli
//或者(or)
yarn global add @vue/cli
等待脚手架安装完成
二、创建项目
// 在终端输入
vue create 要创建项目的名字
//或者(or)
vue ui
//这时会弹出一个
Your connection to the default npm registry seems to be slow.
Use https://registry.npmmirror.com for faster installation? (Y/n)
//这里我们选择Y
//然后下面会弹出
? Please pick a preset: (Use arrow keys)
> Default ([Vue 3] babel, eslint)
Default ([Vue 2] babel, eslint)
Manually select features
//这里是选择vue的版本,这里我们选择第三个Manually select features,键盘的方向键控制,选择好后敲击回车
? 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
( ) TypeScript
(*) Progressive Web App (PWA) Support
>(*) Router
(*) Vuex
(*) CSS Pre-processors
( ) Linter / Formatter
( ) Unit Testing
( ) E2E Testing
//这里需要选择这些配置,键盘的方向键控制,空格键选择,全部选择好后敲击回车
? Choose a version of Vue.js that you want to start the project with (Use arrow keys)
> 3.x
> 2.x
//这里是让我们选择版本,我们这里选择2.x然后回车
? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n)
//这里我们选Y,然后回车
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): (Use arrow keys)
> Sass/SCSS (with dart-sass)
Less
Stylus
//这里我们选择默认的Sass/SCSS (with dart-sass)即可,敲击回车
? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
In dedicated config files
> In package.json
//这里我们选择package.json,然后敲击回车
Save this as a preset for future projects? (y/N)
//这里是问你是否需要保存这次的配置,下次创建项目可以看到,这里我们选N,然后敲击回车
//到这里我们的项目已经常见完成,跑完以后会出现下面这些东西
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)