Element UI Vue CLI Plugin

1.0.1 · deprecated · verified Sun Apr 19

This plugin integrates Element UI, a comprehensive UI toolkit for Vue.js 2.x, into projects initialized with `@vue/cli` versions 3.x and 4.x. It streamlines the setup process by providing automated scaffolding, configuration, and optional on-demand import capabilities for Element UI components. While the provided version is 1.0.1, the underlying `element-ui` library (v2.15.14) is specifically for Vue 2, and the `@vue/cli` framework itself is now in maintenance mode, superseded by faster build tools like Vite. Developers starting new Vue 3 projects are encouraged to use Element Plus with Vite, as this plugin targets a legacy technology stack. This plugin significantly simplifies the initial integration for Vue 2 applications, reducing manual configuration steps for a large component library.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to install the plugin and quickly set up a Vue CLI project with Element UI components like Button and Input, and use a message box.

vue create my-element-app
cd my-element-app
vue add element

# When prompted:
# ? How do you want to import Element? (Use arrow keys)
# > Full import
#   Import on demand
# ? Choose Element theme: (Use arrow keys)
# > Default
#   Customize

# Example usage in a component (e.g., src/components/HelloWorld.vue or src/App.vue)
// <template>
//   <div id="app">
//     <el-button type="primary" @click="showAlert">Click Me</el-button>
//     <el-input v-model="message" placeholder="Please input"></el-input>
//   </div>
// </template>

// <script>
// export default {
//   name: 'App',
//   data() {
//     return {
//       message: ''
//     };
//   },
//   methods: {
//     showAlert() {
//       this.$alert('Hello from Element UI!', 'Greeting', {
//         confirmButtonText: 'OK',
//       });
//     }
//   }
// };
// </script>

view raw JSON →