A, install,

Bring up the CMD input command NPM I element-ui-s in the desired workspace

Two, on demand introduction

Install: NPM install babel-plugin-component -d change.babelrc to: (or babel.config.js)

{
  "presets": [["es2015", { "modules": false }]],
  "plugins": [["component",
      {
        "libraryName": "element-ui"."styleLibraryName": "theme-chalk"}}]]Copy the code

Then import the required sections in main.js and check the official documentation for the required components: Element’s website

import Vue from 'vue';
import { Button, Select } from 'element-ui';
import App from './App.vue';

Vue.component(Button.name, Button);
Vue.component(Select.name, Select);
Use (Button) * vue.use (Select) */

new Vue({
  el: '#app'.render: h= > h(App)
});
Copy the code

Three, overall introduction

Write the following in main.js, with repeated deletions

import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';

Vue.use(ElementUI);

new Vue({
  el: '#app'.render: h= > h(App)
});
Copy the code

Four, test,

Check the official documentation for required components: Element’s website

.<template>
  <div>
    <el-button type="success">Successful button</el-button>
  </div>
</template>
Copy the code

The effect