1.node 安装淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
2.安装vue
sudo npm install -g @vue/cli
4.安装webpack
sudo cnpm install -g webpack
5.创建项目
vue create vue-ele-ui
Vue CLI v3.5.1
? Please pick a preset:
default (babel, eslint)
❯ Manually select features
Vue CLI v3.5.1
? Please pick a preset: Manually select features
? Check the features needed for your project:
❯◉ Babel
◯ TypeScript
◯ Progressive Web App (PWA) Support
◉ Router
◉ Vuex
◉ CSS Pre-processors
◉ Linter / Formatter
◯ Unit Testing
◯ E2E Testing
Vue CLI v3.5.1
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, Router, Vuex, CSS Pre-proce
ssors, Linter
? Use history mode for router? (Requires proper server setup for index fallback
in production) (Y/n) n
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported
by default):
Sass/SCSS (with dart-sass)
❯ Sass/SCSS (with node-sass)
Less
Stylus
? Pick a linter / formatter config:
ESLint with error prevention only
ESLint + Airbnb config
❯ ESLint + Standard config
ESLint + Prettier
? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i
> to invert selection)
❯◉ Lint on save
◯ Lint and fix on commit
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.?
In dedicated config files
❯ In package.json
? Save this as a preset for future projects? (y/N) n
⚓ Running completion hooks...
? Generating README.md...
? Successfully created project vue-ele-ui.
? Get started with the following commands:
$ cd vue-ele-ui
$ npm run serve
6.进入项目目录,安装element
vue add element
? Installing vue-cli-plugin-element...
vue-ele-ui@0.1.0 /home/ljz/dev/src/vue/vue-ele-ui
└── vue-cli-plugin-element@1.0.1
✔ Successfully installed plugin: vue-cli-plugin-element
? How do you want to import Element? Fully import
? Do you wish to overwrite Element's SCSS variables? Yes
? Choose the locale you want to load zh-CN
? Invoking generator for vue-cli-plugin-element...
? Installing additional dependencies...
vue-ele-ui@0.1.0 /home/ljz/dev/src/vue/vue-ele-ui
└─┬ element-ui@2.6.1
├─┬ async-validator@1.8.5
│ └─┬ babel-runtime@6.26.0
│ └── regenerator-runtime@0.11.1
├── babel-helper-vue-jsx-merge-props@2.0.3
├── normalize-wheel@1.0.1
├── resize-observer-polyfill@1.5.1
└── throttle-debounce@1.1.0
⚓ Running completion hooks...
✔ Successfully invoked generator for plugin: vue-cli-plugin-element
The following files have been updated / added:
src/element-variables.scss
src/plugins/element.js
package.json
src/App.vue
src/main.js
You should review these changes with git diff and commit them.
运行项目
npm run serve