element---组件

本文详细介绍了Element UI的基础组件,包括Layout布局、Container布局容器、色彩系统、字体 Typography、边框 Border、Icon图标、Button按钮和Link文字链接的使用方法和特性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Basic

一、Layout布局

  1. 基础布局
    栅格布局

    bg-purple-dark"></div></el-col> </el-row> <el-row>   <el-col
    :span="12"><div class="grid-content bg-purple"></div></el-col>  
    <el-col :span="12"><div class="grid-content
    bg-purple-light"></div></el-col> </el-row> <el-row>   <el-col
    :span="8"><div class="grid-content bg-purple"></div></el-col>  
    <el-col :span="8"><div class="grid-content
    bg-purple-light"></div></el-col>   <el-col :span="8"><div
    class="grid-content bg-purple"></div></el-col> </el-row> <el-row>  
    <el-col :span="6"><div class="grid-content
    bg-purple"></div></el-col>   <el-col :span="6"><div
    class="grid-content bg-purple-light"></div></el-col>   <el-col
    :span="6"><div class="grid-content bg-purple"></div></el-col>  
    <el-col :span="6"><div class="grid-content
    bg-purple-light"></div></el-col> </el-row> <el-row>   <el-col
    :span="4"><div class="grid-content bg-purple"></div></el-col>  
    <el-col :span="4"><div class="grid-content
    bg-purple-light"></div></el-col>   <el-col :span="4"><div
    class="grid-content bg-purple"></div></el-col>   <el-col
    :span="4"><div class="grid-content bg-purple-light"></div></el-col> 
    <el-col :span="4"><div class="grid-content
    bg-purple"></div></el-col>   <el-col :span="4"><div
    class="grid-content bg-purple-light"></div></el-col> </el-row>
    
    <style>   .el-row {
        margin-bottom: 20px;
        &:last-child {
          margin-bottom: 0;
        }   }   .el-col {
        border-radius: 4px;   }   .bg-purple-dark {
        background: #99a9bf;   }   .bg-purple {
        background: #d3dce6;   }   .bg-purple-light {
        background: #e5e9f2;   }   .grid-content {
        border-radius: 4px;
        min-height: 36px;   }   .row-bg {
        padding: 10px 0;
        background-color: #f9fafc;   } </style> ```
    
  2. 分栏间隔
    分栏之间存在间隔

<el-row :gutter="20">
  <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
  <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
  <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
  <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
</el-row>

<style>
  .el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
</style>

3.响应式布局
在这里插入图片描述

<el-row :gutter="10">
  <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="1"><div class="grid-content bg-purple"></div></el-col>
  <el-col :xs="4" :sm="6" :md="8" :lg="9" :xl="11"><div class="grid-content bg-purple-light"></div></el-col>
  <el-col :xs="4" :sm="6" :md="8" :lg="9" :xl="11"><div class="grid-content bg-purple"></div></el-col>
  <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="1"><div class="grid-content bg-purple-light"></div></el-col>
</el-row>

<style>
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
</style>

二、Container 布局容器
用于布局的容器组件,方便快速搭建页面的基本结构:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

<el-container>
  <el-header>Header</el-header>
  <el-main>Main</el-main>
</el-container>

<el-container>
  <el-header>Header</el-header>
  <el-main>Main</el-main>
  <el-footer>Footer</el-footer>
</el-container>

<el-container>
  <el-aside width="200px">Aside</el-aside>
  <el-main>Main</el-main>
</el-container>

<el-container>
  <el-header>Header</el-header>
  <el-container>
    <el-aside width="200px">Aside</el-aside>
    <el-main>Main</el-main>
  </el-container>
</el-container>

<el-container>
  <el-header>Header</el-header>
  <el-container>
    <el-aside width="200px">Aside</el-aside>
    <el-container>
      <el-main>Main</el-main>
      <el-footer>Footer</el-footer>
    </el-container>
  </el-container>
</el-container>

<el-container>
  <el-aside width="200px">Aside</el-aside>
  <el-container>
    <el-header>Header</el-header>
    <el-main>Main</el-main>
  </el-container>
</el-container>

<el-container>
  <el-aside width="200px">Aside</el-aside>
  <el-container>
    <el-header>Header</el-header>
    <el-main>Main</el-main>
    <el-footer>Footer</el-footer>
  </el-container>
</el-container>

<style>
  .el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }
  
  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 160px;
  }
  
  body > .el-container {
    margin-bottom: 40px;
  }
  
  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }
  
  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>

三、color色彩

  1. 主色
    Element 主要品牌颜色是鲜艳、友好的蓝色。
    在这里插入图片描述

  2. 辅助色
    除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。
    在这里插入图片描述

  3. 中性色
    中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。
    在这里插入图片描述

四、Typography 字体

  1. 字体
    在这里插入图片描述

  2. 字号
    在这里插入图片描述

3.行高
在这里插入图片描述

  1. Font-family 代码
font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;

五、Border边框

  1. 边框
    在这里插入图片描述
  2. 圆角
    在这里插入图片描述
  3. 投影
    在这里插入图片描述

六、Icon图标

  1. 使用方法:
    在这里插入图片描述
<i class="el-icon-edit"></i>
<i class="el-icon-share"></i>
<i class="el-icon-delete"></i>
<el-button type="primary" icon="el-icon-search">搜索</el-button>

  1. 图表集合
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

七、Button按钮

  1. 基础用法
    在这里插入图片描述
<el-row>
  <el-button>默认按钮</el-button>
  <el-button type="primary">主要按钮</el-button>
  <el-button type="success">成功按钮</el-button>
  <el-button type="info">信息按钮</el-button>
  <el-button type="warning">警告按钮</el-button>
  <el-button type="danger">危险按钮</el-button>
</el-row>

<el-row>
  <el-button plain>朴素按钮</el-button>
  <el-button type="primary" plain>主要按钮</el-button>
  <el-button type="success" plain>成功按钮</el-button>
  <el-button type="info" plain>信息按钮</el-button>
  <el-button type="warning" plain>警告按钮</el-button>
  <el-button type="danger" plain>危险按钮</el-button>
</el-row>

<el-row>
  <el-button round>圆角按钮</el-button>
  <el-button type="primary" round>主要按钮</el-button>
  <el-button type="success" round>成功按钮</el-button>
  <el-button type="info" round>信息按钮</el-button>
  <el-button type="warning" round>警告按钮</el-button>
  <el-button type="danger" round>危险按钮</el-button>
</el-row>

<el-row>
  <el-button icon="el-icon-search" circle></el-button>
  <el-button type="primary" icon="el-icon-edit" circle></el-button>
  <el-button type="success" icon="el-icon-check" circle></el-button>
  <el-button type="info" icon="el-icon-message" circle></el-button>
  <el-button type="warning" icon="el-icon-star-off" circle></el-button>
  <el-button type="danger" icon="el-icon-delete" circle></el-button>
</el-row>
  1. 禁用状态
    在这里插入图片描述
<el-row>
  <el-button disabled>默认按钮</el-button>
  <el-button type="primary" disabled>主要按钮</el-button>
  <el-button type="success" disabled>成功按钮</el-button>
  <el-button type="info" disabled>信息按钮</el-button>
  <el-button type="warning" disabled>警告按钮</el-button>
  <el-button type="danger" disabled>危险按钮</el-button>
</el-row>

  1. 文字按钮
    在这里插入图片描述
    在这里插入图片描述

  2. 图标按钮
    在这里插入图片描述

<el-button type="primary" icon="el-icon-edit"></el-button>
<el-button type="primary" icon="el-icon-share"></el-button>
<el-button type="primary" icon="el-icon-delete"></el-button>
<el-button type="primary" icon="el-icon-search">搜索</el-button>
<el-button type="primary">上传<i class="el-icon-upload el-icon--right"></i></el-button>

5.按钮组
在这里插入图片描述

<el-button-group>
  <el-button type="primary" icon="el-icon-arrow-left">上一页</el-button>
  <el-button type="primary">下一页<i class="el-icon-arrow-right el-icon--right"></i></el-button>
</el-button-group>
<el-button-group>
  <el-button type="primary" icon="el-icon-edit"></el-button>
  <el-button type="primary" icon="el-icon-share"></el-button>
  <el-button type="primary" icon="el-icon-delete"></el-button>
</el-button-group>
  1. 加载中
    在这里插入图片描述
<el-button type="primary" :loading="true">加载中</el-button>
  1. 不同尺寸
    在这里插入图片描述
    在这里插入图片描述
<el-row>
  <el-button>默认按钮</el-button>
  <el-button size="medium">中等按钮</el-button>
  <el-button size="small">小型按钮</el-button>
  <el-button size="mini">超小按钮</el-button>
</el-row>
<el-row>
  <el-button round>默认按钮</el-button>
  <el-button size="medium" round>中等按钮</el-button>
  <el-button size="small" round>小型按钮</el-button>
  <el-button size="mini" round>超小按钮</el-button>
</el-row>

八、Link文字链接

  1. 基础用法
    在这里插入图片描述
<div>
  <el-link href="https://element.eleme.io" target="_blank">默认链接</el-link>
  <el-link type="primary">主要链接</el-link>
  <el-link type="success">成功链接</el-link>
  <el-link type="warning">警告链接</el-link>
  <el-link type="danger">危险链接</el-link>
  <el-link type="info">信息链接</el-link>
</div>
  1. 禁用状态
    在这里插入图片描述
<div>
  <el-link disabled>默认链接</el-link>
  <el-link type="primary" disabled>主要链接</el-link>
  <el-link type="success" disabled>成功链接</el-link>
  <el-link type="warning" disabled>警告链接</el-link>
  <el-link type="danger" disabled>危险链接</el-link>
  <el-link type="info" disabled>信息链接</el-link>
</div>

  1. 下划线(文字链接下划线)
    在这里插入图片描述
<div>
  <el-link :underline="false">无下划线</el-link>
  <el-link>有下划线</el-link>
</div>
  1. 图标
    在这里插入图片描述
<div>
  <el-link icon="el-icon-edit">编辑</el-link>
  <el-link>查看<i class="el-icon-view el-icon--right"></i> </el-link>
</div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值