1 02.引入ElementPlus和基本使用

  • 安装

npm install element-plus --save
  • 使用 ElementPlus

import { createApp } from 'vue'
import './style.css'
import App from './App.vue'

import ElementPlus from 'element-plus' // +
import 'element-plus/dist/index.css'   // +



const app =  createApp(App)       // 修改

app.use(ElementPlus) // +
app.mount('#app')    // +
  • 组件使用

    复制粘贴一段代码

<template>
  <el-row class="mb-4">
    <el-button>Default</el-button>
    <el-button type="primary">Primary</el-button>
    <el-button type="success">Success</el-button>
    <el-button type="info">Info</el-button>
    <el-button type="warning">Warning</el-button>
    <el-button type="danger">Danger</el-button>
  </el-row>
</template>

Last updated