Element el-button 按鈕組件的使用詳解
1. 背景
按鈕是很常用的,Element的按鈕功能還是比較全面的,本篇就來介紹下。
先看下各種按鈕的效果圖:

在分析源碼前,我們先來看一下官方文檔對(duì)于button的使用說明:

2. 按鈕分類
el-button按鈕的分類基本是靠顏色區(qū)分的,另外還有一種文本按鈕type="text",文本按鈕由于比較小,比較適合用于表格每行的操作欄部分。
按鈕分類:
<el-button>默認(rèn)</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-button type="text">text</el-button>
3. 按鈕樣式
Element提供了樸素按鈕、圓角按鈕、圓形按鈕,需要注意的是圓形按鈕一般只放一個(gè)圖標(biāo)進(jìn)去,代碼如下:
按鈕樣式:
<el-button type="primary" plain>樸素按鈕</el-button> <el-button type="primary" round>圓角按鈕</el-button> <el-button type="primary" circle icon="el-icon-search"></el-button>
4. 按鈕狀態(tài)
按鈕狀態(tài)其實(shí)就是HTML標(biāo)準(zhǔn)的功能,通過disabled實(shí)現(xiàn)禁用即可。
按鈕狀態(tài):
<el-button type="primary">正常</el-button> <el-button type="primary" disabled>禁用</el-button>
5. 按鈕分組
按鈕分組很好用,像常見的分頁按鈕,分成一組的話更加好看,通過<el-button-group>將按鈕包裹起來,即可實(shí)現(xiàn)。
按鈕分組:
<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>
6. 按鈕尺寸
餓了提供了默認(rèn)、中、小、很小四種尺寸,代碼如下:
按鈕的尺寸:
<el-button>默認(rèn)</el-button> <el-button type="primary" size="medium ">medium</el-button> <el-button type="primary" size="small">small</el-button> <el-button type="primary" size="mini">mini</el-button>
7. 小結(jié)
el-button提供的功能已經(jīng)比較完善了,拿來即可即可。注意不推薦自己定義style來修改默認(rèn)樣式,容易導(dǎo)致外觀不統(tǒng)一。
到此這篇關(guān)于Element el-button 按鈕組件的使用詳解的文章就介紹到這了,更多相關(guān)Element el-button 按鈕組件內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
解決vue處理axios post請(qǐng)求傳參的問題
下面小編就為大家分享一篇解決vue處理axios post請(qǐng)求傳參的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-03-03
vue 修改 data 數(shù)據(jù)問題并實(shí)時(shí)顯示的方法
今天小編就為大家分享一篇vue 修改 data 數(shù)據(jù)問題并實(shí)時(shí)顯示的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-08-08
Vue動(dòng)態(tài)組件component標(biāo)簽的用法大全
這篇文章主要介紹了Vue動(dòng)態(tài)組件component標(biāo)簽的用法,在Vue中,可以通過component標(biāo)簽的is屬性動(dòng)態(tài)指定標(biāo)簽,本文通過示例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2022-08-08
vue3中使用ant-design-vue的layout組件實(shí)現(xiàn)動(dòng)態(tài)導(dǎo)航欄和面包屑功能
這篇文章主要介紹了vue3中使用ant-design-vue的layout組件實(shí)現(xiàn)動(dòng)態(tài)導(dǎo)航欄和面包屑功能,基于一個(gè)新建的Vue3項(xiàng)目上實(shí)現(xiàn),本文結(jié)合示例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2023-01-01
圖文詳解vue中proto文件的函數(shù)調(diào)用
這篇文章主要給大家介紹了vue中proto文件函數(shù)調(diào)用的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用vue具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2021-08-08

