一,安装vue脚手架(vue-cli)
npm install -g @vue/cli
二,检查脚手架是否安装成功
vue -V
三,创建项目vue create '项目名称'
vue create hello-vue
- 选择Manually select features(手动配置选项)
-
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 //测试
采用上下键选择,采用空格键选择该项
-
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
-
- 是否使用history模式路由,根据个人需求(y/n)
? Use history mode for router? (Requires proper server setup for index fallback
in production) (Y/n) //是否使用history模式
- 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 //启动项目