elementUI 學習入門之 Button 按鈕


基礎按鈕用法

<!--            <a-button type="primary" style="margin: 0 8px"  @click="insertEvent">新增</a-button>-->
            <vxe-button status="primary"  @click="insertEvent" content="新增"></vxe-button>
<!--            <a-button type="success" style="margin: 0 8px"  @click="handleSave">保存</a-button>-->
            <vxe-button status="success"  @click="handleSave" content="保存"></vxe-button>
<!--            <a-button type="primary" style="margin: 0 8px" @click="handleSave">編輯</a-button>-->
            <vxe-button status="danger"  @click="handleDelete" content="刪除"></vxe-button>
<!--            <a-button type="danger" style="margin: 0 8px" @click="handleDelete">刪除</a-button>-->

              <vxe-button content="默認顏色"></vxe-button>
              <vxe-button status="primary" content="主要顏色"></vxe-button>
              <vxe-button status="success" content="成功顏色"></vxe-button>
              <vxe-button status="info" content="信息顏色"></vxe-button>
              <vxe-button status="warning" content="警告顏色"></vxe-button>
              <vxe-button status="danger" content="危險顏色"></vxe-button>
              <vxe-button content="默認禁用顏色" disabled></vxe-button>
              <vxe-button status="primary" content="主要禁用顏色" disabled></vxe-button>
              <vxe-button status="success" content="成功禁用顏色" disabled></vxe-button>
              <vxe-button status="info" content="信息禁用顏色" disabled></vxe-button>
              <vxe-button status="warning" content="警告禁用顏色" disabled></vxe-button>
              <vxe-button status="danger" content="危險禁用顏色" disabled></vxe-button>
              <vxe-button content="默認顏色" loading></vxe-button>
              <vxe-button status="primary" content="主要顏色" loading></vxe-button>
              <vxe-button status="success" content="成功顏色" loading></vxe-button>
              <vxe-button status="info" content="信息顏色" loading></vxe-button>
              <vxe-button status="warning" content="警告顏色" loading></vxe-button>
              <vxe-button status="danger" content="危險顏色" loading></vxe-button>

  按鈕分為:默認按鈕、朴素按鈕(plain)、圓角按鈕(round)、圓形按鈕(circle)。eg:

  <el-button plain>朴素按鈕</el-button>

  通過 type 屬性指定 primary、success、info、warning、danger、text 其中的值設置按鈕樣式,其中若設置值為 text ,則為文字按鈕,沒有邊框和背景顏色

 

 1 <el-row>
 2   <el-button>默認按鈕</el-button>
 3   <el-button type="primary">主要按鈕</el-button>
 4   <el-button type="success">成功按鈕</el-button>
 5   <el-button type="info">信息按鈕</el-button>
 6   <el-button type="warning">警告按鈕</el-button>
 7   <el-button type="danger">危險按鈕</el-button>
 8 </el-row>
 9 
10 <el-row>
11   <el-button plain>朴素按鈕</el-button>
12   <el-button type="primary" plain>主要按鈕</el-button>
13   <el-button type="success" plain>成功按鈕</el-button>
14   <el-button type="info" plain>信息按鈕</el-button>
15   <el-button type="warning" plain>警告按鈕</el-button>
16   <el-button type="danger" plain>危險按鈕</el-button>
17 </el-row>
18 
19 <el-row>
20   <el-button round>圓角按鈕</el-button>
21   <el-button type="primary" round>主要按鈕</el-button>
22   <el-button type="success" round>成功按鈕</el-button>
23   <el-button type="info" round>信息按鈕</el-button>
24   <el-button type="warning" round>警告按鈕</el-button>
25   <el-button type="danger" round>危險按鈕</el-button>
26 </el-row>
27 
28 <el-row>
29   <el-button icon="el-icon-search" circle></el-button>
30   <el-button type="primary" icon="el-icon-edit" circle></el-button>
31   <el-button type="success" icon="el-icon-check" circle></el-button>
32   <el-button type="info" icon="el-icon-message" circle></el-button>
33   <el-button type="warning" icon="el-icon-star-off" circle></el-button>
34   <el-button type="danger" icon="el-icon-delete" circle></el-button>
35 </el-row>

按鈕樣式

添加 disabled 屬性設置按鈕禁用;設置 loading 屬性值為 true ,在按鈕上顯示加載狀態

圖標按鈕

  設置 icon 屬性值即可。eg:

 <el-button type="primary" icon="el-icon-search">搜索</el-button>

按鈕組

  使用 <el-button-group> 標簽嵌套標簽組。eg:

 

1 <el-button-group>
2   <el-button type="primary" icon="el-icon-arrow-left">上一頁</el-button>
3   <el-button type="primary">下一頁<i class="el-icon-arrow-right el-icon--right"></i></el-button>
4 </el-button-group>
5 <el-button-group>
6   <el-button type="primary" icon="el-icon-edit"></el-button>
7   <el-button type="primary" icon="el-icon-share"></el-button>
8   <el-button type="primary" icon="el-icon-delete"></el-button>
9 </el-button-group>

標簽組

Button 組件提供了除默認按鈕大小以外的 medium、small、mini 三種大小,通過設置 size 屬性來配置

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM