Element Plus FAQ

This page lists common issues and solutions when using Element Plus.

Installation Issues

Installation Failed

Symptoms: npm install or yarn add fails

Solutions:

  1. Check Node.js version, ensure >= 14.0.0
  2. Clear npm cache:
    npm cache clean --force
    
  3. Delete node_modules and package-lock.json, then reinstall

TypeScript Type Errors

Symptoms: Type errors when importing components

Solutions:

  1. Make sure Volar plugin is installed
  2. Add to tsconfig.json:
    {
      "compilerOptions": {
        "types": ["element-plus/global"]
      }
    }
    

Usage Issues

Component Styles Not Applied

Symptoms: Component styles don't match expectations

Solutions:

  1. Make sure CSS is correctly imported:
    import 'element-plus/dist/index.css'
    
  2. Check for global style overrides

Icons Not Displayed

Symptoms: Icon components show blank or squares

Solutions:

  1. Install icon library:

    npm install @element-plus/icons-vue
    
  2. Register icons globally:

    import * as icons from '@element-plus/icons-vue'
    for (const [key, component] of Object.entries(icons)) {
      app.component(key, component)
    }
    

On-Demand Import Not Working

Symptoms: Bundle size still large

Solutions:

  1. Check if plugin configuration is correct
  2. Ensure correct resolver is used

Internationalization Not Working

Symptoms: Component text doesn't change after language switch

Solutions:

  1. Import language pack correctly:
    import en from 'element-plus/es/locale/lang/en'
    
  2. Configure locale:
    app.use(ElementPlus, { locale: en })
    

Component Issues

Table Issues

Table Sorting Not Working

Make sure prop attribute is set:

<el-table-column prop="date" sortable />

Table Fixed Columns Misaligned

Make sure table has fixed height:

<el-table :data="data" height="300" />

Form Issues

Form Validation Not Triggering

Make sure el-form-item has prop attribute:

<el-form-item label="Name" prop="name">
  <el-input v-model="ruleForm.name" />
</el-form-item>

Dialog Issues

Dialog Scrolling Issues

When dialog content is too long, make sure to add scrolling:

<el-dialog>
  <div style="max-height: 60vh; overflow-y: auto;">
    <!-- Content -->
  </div>
</el-dialog>

Style Issues

Style Conflicts

Symptoms: Custom styles are overridden

Solutions:

  1. Use more specific selectors
  2. Use ::v-deep or :deep()

Theme Color Not Applied

Check if CSS variables are correctly overridden:

:root {
  --el-color-primary: #409eff;
}

Make sure it's loaded after element-plus styles.

Performance Issues

Page Lag

For large datasets:

  1. Use el-table-v2 (virtual table)
  2. Use pagination to load data
  3. Avoid complex components in tables

Bundle Size Too Large

  1. Use on-demand import
  2. Remove unused plugins

Vue Version Issues

Not Compatible with Vue 2

Element Plus only supports Vue 3. If you need Vue 2, use Element UI.

Composition API Not Supported

Make sure to use Vue 3.2+ for better Composition API support.

Getting Help