Skip to content

๐Ÿš€ Quick Start โ€‹

Welcome to the Element Plus Study Guide! This guide will help you quickly set up your development environment and begin your Element Plus learning journey.

๐Ÿ“‹ Learning Roadmap โ€‹

mermaid
graph TD
    A[Environment Preparation] --> B[Project Initialization]
    B --> C[Element Plus Installation & Configuration]
    C --> D[Design Principles Learning]
    D --> E[First Component Practice]
    E --> F[Project Structure Optimization]
    F --> G[Begin Systematic Learning]

๐ŸŽฏ Learning Objectives โ€‹

  • โœ… Set up a modern Vue 3 + Element Plus development environment
  • โœ… Understand Element Plus core design principles
  • โœ… Master basic component usage methods
  • โœ… Create your first complete component demo page
  • โœ… Establish good code standards and project structure

๐Ÿ› ๏ธ Environment Preparation โ€‹

System Requirements โ€‹

ToolVersion RequirementRecommended VersionDescription
Node.js>= 16.0.018.x LTSJavaScript runtime environment
npm>= 7.0.0Latest versionPackage manager
Vue>= 3.3.03.5.xFrontend framework
Element Plus>= 2.4.02.10.xUI component library
  • IDE: VS Code + Volar extension
  • Browser: Chrome/Edge (with Vue DevTools support)
  • Package Manager: pnpm (recommended) / yarn / npm

๐Ÿ—๏ธ Project Initialization โ€‹

bash
# Clone the project
git clone https://github.com/shingle666/element-plus-study.git
cd element-plus-study

# Install dependencies
npm install
# Or use pnpm (recommended)
pnpm install

# Start development server
npm run dev

# Start documentation server
npm run docs:dev

Option 2: Create Project from Scratch โ€‹

bash
# Create Vue 3 project with Vite
npm create vue@latest my-element-plus-app
cd my-element-plus-app

# Install dependencies
npm install

# Install Element Plus
npm install element-plus @element-plus/icons-vue

# Install auto-import plugins (optional but recommended)
npm install -D unplugin-vue-components unplugin-auto-import

โš™๏ธ Element Plus Configuration โ€‹

Full Import (Suitable for Learning Phase) โ€‹

Configure in src/main.js:

javascript
import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)

// Register all icons
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(ElementPlus)
app.mount('#app')

Configure in vite.config.js:

javascript
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
})

๐ŸŽจ Deep Understanding of Design Principles โ€‹

Element Plus follows four core design principles, understanding these principles is crucial for using components correctly:

๐Ÿ”„ Consistency โ€‹

Consistent with Real Life

  • Follow users' cognitive habits
  • Use common interaction patterns
  • Maintain consistency in language expression

Consistent Interface Elements

  • Unified visual style
  • Consistent interaction behavior
  • Standardized layout structure

๐Ÿ’ฌ Feedback โ€‹

Control Feedback

  • Visual feedback for button clicks
  • Real-time form validation prompts
  • Clear loading state display

Page Feedback

  • Clear display of operation results
  • Accurate error message communication
  • Timely success state feedback

โšก Efficiency โ€‹

Simplified Process

  • Reduce unnecessary operation steps
  • Provide shortcut operation methods
  • Smart default value settings

Clear and Explicit

  • Concise text expression
  • Intuitive icon design
  • Clear operation guidance

๐ŸŽ›๏ธ Controllability โ€‹

User Decision

  • Provide operation suggestions rather than forcing
  • Important operations require confirmation
  • Preserve user choice

Controllable Results

  • Support undo operations
  • Provide fallback mechanisms
  • Allow process interruption

๐ŸŽฏ First Component Practice: Button โ€‹

Let's practice using Element Plus with the Button component:

Create Demo Page โ€‹

Create ButtonDemo.vue in the src/views/ directory:

vue
<template>
  <div class="button-demo-container">
    <h2>๐ŸŽฏ Button Component Learning Practice</h2>
    
    <!-- Basic Buttons -->
    <section class="demo-section">
      <h3>Basic Buttons</h3>
      <div class="button-group">
        <el-button>Default Button</el-button>
        <el-button type="primary">Primary Button</el-button>
        <el-button type="success">Success Button</el-button>
        <el-button type="info">Info Button</el-button>
        <el-button type="warning">Warning Button</el-button>
        <el-button type="danger">Danger Button</el-button>
      </div>
    </section>

    <!-- Plain Buttons -->
    <section class="demo-section">
      <h3>Plain Buttons</h3>
      <div class="button-group">
        <el-button plain>Plain Button</el-button>
        <el-button type="primary" plain>Primary Button</el-button>
        <el-button type="success" plain>Success Button</el-button>
        <el-button type="info" plain>Info Button</el-button>
        <el-button type="warning" plain>Warning Button</el-button>
        <el-button type="danger" plain>Danger Button</el-button>
      </div>
    </section>

    <!-- Button Sizes -->
    <section class="demo-section">
      <h3>Button Sizes</h3>
      <div class="button-group">
        <el-button size="large">Large Button</el-button>
        <el-button>Default Button</el-button>
        <el-button size="small">Small Button</el-button>
      </div>
    </section>

    <!-- Button States -->
    <section class="demo-section">
      <h3>Button States</h3>
      <div class="button-group">
        <el-button :loading="loading" @click="handleLoading">Loading Button</el-button>
        <el-button disabled>Disabled Button</el-button>
        <el-button type="primary" :icon="Search">Search</el-button>
        <el-button type="primary" circle :icon="Plus" />
      </div>
    </section>

    <!-- Interaction Demo -->
    <section class="demo-section">
      <h3>Interaction Demo</h3>
      <div class="button-group">
        <el-button type="success" @click="showMessage('success')">Success Message</el-button>
        <el-button type="warning" @click="showMessage('warning')">Warning Message</el-button>
        <el-button type="danger" @click="showMessage('error')">Error Message</el-button>
      </div>
    </section>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { Search, Plus } from '@element-plus/icons-vue'

const loading = ref(false)

const handleLoading = () => {
  loading.value = true
  setTimeout(() => {
    loading.value = false
    ElMessage.success('Loading complete!')
  }, 2000)
}

const showMessage = (type) => {
  const messages = {
    success: 'Operation successful!',
    warning: 'Please note!',
    error: 'Operation failed!'
  }
  ElMessage[type](messages[type])
}
</script>

<style scoped>
.button-demo-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.demo-section {
  margin-bottom: 40px;
  padding: 20px;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  background-color: #fafafa;
}

.demo-section h3 {
  margin-bottom: 16px;
  color: #303133;
  font-size: 18px;
}

.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.button-group .el-button {
  margin: 0;
}
</style>

Router Configuration โ€‹

Add route in src/router/index.js:

javascript
import { createRouter, createWebHistory } from 'vue-router'
import ButtonDemo from '../views/ButtonDemo.vue'

const routes = [
  {
    path: '/button-demo',
    name: 'ButtonDemo',
    component: ButtonDemo
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router

โœ… Learning Checklist โ€‹

Environment Setup โ€‹

  • [ ] โœ… Node.js version >= 16.0.0
  • [ ] โœ… Successfully created Vue 3 project
  • [ ] โœ… Element Plus installed and configured
  • [ ] โœ… Development server started normally
  • [ ] โœ… Browser can access the project normally

Design Principles Understanding โ€‹

  • [ ] ๐Ÿ“– Understand the importance of consistency principle
  • [ ] ๐Ÿ“– Master application scenarios of feedback principle
  • [ ] ๐Ÿ“– Learn practical methods of efficiency principle
  • [ ] ๐Ÿ“– Clarify design ideas of controllability principle

Component Practice โ€‹

  • [ ] ๐ŸŽฏ Create Button component demo page
  • [ ] ๐ŸŽฏ Implement different types of buttons
  • [ ] ๐ŸŽฏ Master button size and state control
  • [ ] ๐ŸŽฏ Complete interaction function demonstration
  • [ ] ๐ŸŽฏ Understand component API design ideas

Code Quality โ€‹

  • [ ] ๐Ÿ’ป Clear and reasonable code structure
  • [ ] ๐Ÿ’ป Follow Vue 3 best practices
  • [ ] ๐Ÿ’ป Unified style standards
  • [ ] ๐Ÿ’ป Complete and accurate comments

๐Ÿ“š Learning Resources โ€‹

Official Documentation โ€‹

Development Tools โ€‹

Community Resources โ€‹

โš ๏ธ Important Notes โ€‹

Environment Requirements โ€‹

  • โœ… Node.js Version: >= 16.0.0 (18.x LTS recommended)
  • โœ… Package Manager: pnpm > yarn > npm recommended
  • โœ… Browser: Modern browsers supporting ES2018+

Best Practices โ€‹

  • ๐ŸŽฏ On-demand Import: Recommended for production to reduce package size
  • ๐Ÿ”ง TypeScript: Recommended for better development experience
  • ๐Ÿ“ฑ Responsive Design: Pay attention to mobile adaptation and responsive layout
  • ๐ŸŽจ Theme Customization: Learn to use CSS variables for theme customization

Common Issues โ€‹

๐Ÿค” What if component styles don't work?
  1. Check if Element Plus CSS file is correctly imported
  2. Confirm if the component is correctly registered
  3. Check for style conflicts or overrides
๐Ÿค” On-demand import configuration failed?
  1. Confirm compatibility of unplugin-vue-components and unplugin-auto-import versions
  2. Check if Vite configuration file syntax is correct
  3. Restart development server
๐Ÿค” Icons not displaying properly?
  1. Confirm @element-plus/icons-vue is installed
  2. Check if icon components are correctly imported and registered
  3. Confirm icon names are spelled correctly

๐Ÿš€ Next Learning Plan โ€‹

Congratulations on completing the Element Plus quick start! Here's a suggested path to continue learning:

๐Ÿ“… Week 1: Master Basic Components โ€‹

๐Ÿ“… Week 2: Form Component Practice โ€‹

๐Ÿ“… Week 3: Data Display Components โ€‹

๐Ÿ“… Advanced Learning โ€‹


๐Ÿ“ Learning Record โ€‹

Learning Date: ___________
Completion Status: ___________
Learning Duration: ___________

๐Ÿ“– Learning Notes โ€‹

Record your learning insights and important knowledge points here:

1. 
2. 
3.

โ“ Problems Encountered โ€‹

Record problems encountered during learning:

Problem 1:
Solution:

Problem 2:
Solution:

๐Ÿ’ก Gains and Insights โ€‹

Record your gains and understanding of Element Plus:

๐ŸŽ‰ Congratulations on completing the quick start!

๐Ÿ“– View Complete Study Guide | ๐Ÿ  Return to Home | ๐Ÿ“‹ View Changelog

Element Plus Study Guide