创建项目cjhtest
1.vue create cjhtest
1.1 ? Please pick a preset:
vue2_vuex_router ([Vue 2] less, babel, router, vuex, eslint)
Default ([Vue 3] babel, eslint)
Default ([Vue 2] babel, eslint)
> Manually select features
用下下方向键 选择 Manually select features 回车
1.2 selection, and <enter> to proceed)
(*) Babel
( ) TypeScript
( ) Progressive Web App (PWA) Support
(*) Router
(*) Vuex
>(*) CSS Pre-processors
(*) Linter / Formatter
( ) Unit Testing
( ) E2E Testing
选择这几项 用 空格 去选择 ,最后按回车键 进入下一步
1.3 ? Choose a version of Vue.js that you want to start the project with
3.x
> 2.x
这是选择VUE 版本,我选择 2.x 回车
1.4 Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n)
是否启用路由模式, 选 n 回车。
1.5 ? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default):
Sass/SCSS (with dart-sass)
> Less
Stylus
选择一种css 预处理器,我这里选择第二个 Less 回车
1.6 ? Pick a linter / formatter config: (Use arrow keys)
> ESLint with error prevention only
ESLint + Airbnb config
ESLint + Standard config
ESLint + Prettier
选择一种代码格式化检测工具,这里我选择第一个
*TSLint: ts格式检验工具
*ESLint with error prevention only: ESLint 只会进行错误提醒
*ESLint + Airbnb config: ESLint Airbnb标准
*ESLint + Standard config: ESLint Standard 标准
*ESLint + Prettier: ESLint(代码质量检测)+ Prettier(代码格式化工具)
1.7 ? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection, and
<enter> to proceed)
>(*) Lint on save
( ) Lint and fix on commit
代码检查方式: 保存时检查 or 提交时检查; 我选择, 保存时检查 Lint on save, 我选择第一个
1.8 Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
> In dedicated config files
In package.json
Babel, PostCSS, ESLin等配置文件怎么存放, 是放到单独的配置文件中?还是package.json里? 我选择 In package.json 。
1.9 ? Save this as a preset for future projects? (y/N)
是否需要保存当前配置,在以后的项目中可快速构建? 保存后, 后续创建项目时可以直接选择该配置, 不需单独配置,我选择 y.
这样下次就不要这么麻烦了。
1.10 ? Save preset as: vue2_cjh
设置当前配置的名称。这个名称会显示在创建项目时的选项上。vue2_cjh 是名称
然后点击回车,会自动初始化项目
$ cd cjhtest
$ npm run serve
看到这个就说明创建成功了
2. 安装 axios
npm i axios -S
3. 安装 vue add element
WARN There are uncommitted changes in the current repository, it's recommended to commit or stash them first.
? Still proceed? (y/N) y
? How do you want to import Element? (Use arrow keys)
> Fully import
Import on demand
您想如何导入元素
> Fully import 全部导入
Import on demand 按需导入
我选择 Import on demand 按需导入
? Choose the locale you want to load (Use arrow keys)
> zh-CN
zh-TW
af-ZA
ar
bg
ca
cs-CZ
(Move up and down to reveal more choices)
选择语言 zh-CN 中文
标签:Use,VUE,项目,创建,选择,ESLint,arrow,config,回车 From: https://www.cnblogs.com/stevenchen2016/p/16756551.html