【Element-ui】Icon 圖標與Button 按鈕

文章目錄

  • 前言
  • 一、Icon 圖標
    • 1.1 作用
    • 1.2 使用方法
    • 1.3 圖標集合
  • 二、Button 按鈕
    • 2.1 基礎用法
    • 2.2 禁用狀態
    • 2.3 文字按鈕
    • 2.4 圖標按鈕
    • 2.5 按鈕組
    • 2.6 加載中
    • 2.7 不同尺寸
  • 總結


前言

在前端開發中,界面的設計和交互是至關重要的一部分。一個直觀、易用的界面往往離不開各種組件的運用。本文將聚焦于Element-ui中的兩個常用組件——Icon圖標和Button按鈕,分別介紹它們的基本用法和一些實用技巧。Icon圖標為界面添加了更多的元素,而Button按鈕則是用戶與頁面進行交互的重要媒介,通過深入理解它們,我們可以更好地打造出美觀、實用的前端界面。


一、Icon 圖標

1.1 作用

提供了一套常用的圖標集合。

1.2 使用方法

直接通過設置類名為 el-icon-iconName 來使用即可。例如:

<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>

在這里插入圖片描述

我們只需要使用i標簽class為圖標名稱即可.如果你使用的是i標簽
如果是其他,則使用icon屬性

1.3 圖標集合

圖標集合如下:

el-icon-platform-eleme
el-icon-eleme
el-icon-delete-solid
el-icon-delete
el-icon-s-tools
el-icon-setting
el-icon-user-solid
el-icon-user
el-icon-phone
el-icon-phone-outline
el-icon-more
el-icon-more-outline
el-icon-star-on
el-icon-star-off
el-icon-s-goods
el-icon-goods
el-icon-warning
el-icon-warning-outline
el-icon-question
el-icon-info
el-icon-remove
el-icon-circle-plus
el-icon-success
el-icon-error
el-icon-zoom-in
el-icon-zoom-out
el-icon-remove-outline
el-icon-circle-plus-outline
el-icon-circle-check
el-icon-circle-close
el-icon-s-help
el-icon-help
el-icon-minus
el-icon-plus
el-icon-check
el-icon-close
el-icon-picture
el-icon-picture-outline
el-icon-picture-outline-round
el-icon-upload
el-icon-upload2
el-icon-download
el-icon-camera-solid
el-icon-camera
el-icon-video-camera-solid
el-icon-video-camera
el-icon-message-solid
el-icon-bell
el-icon-s-cooperation
el-icon-s-order
el-icon-s-platform
el-icon-s-fold
el-icon-s-unfold
el-icon-s-operation
el-icon-s-promotion
el-icon-s-home
el-icon-s-release
el-icon-s-ticket
el-icon-s-management
el-icon-s-open
el-icon-s-shop
el-icon-s-marketing
el-icon-s-flag
el-icon-s-comment
el-icon-s-finance
el-icon-s-claim
el-icon-s-custom
el-icon-s-opportunity
el-icon-s-data
el-icon-s-check
el-icon-s-grid
el-icon-menu
el-icon-share
el-icon-d-caret
el-icon-caret-left
el-icon-caret-right
el-icon-caret-bottom
el-icon-caret-top
el-icon-bottom-left
el-icon-bottom-right
el-icon-back
el-icon-right
el-icon-bottom
el-icon-top
el-icon-top-left
el-icon-top-right
el-icon-arrow-left
el-icon-arrow-right
el-icon-arrow-down
el-icon-arrow-up
el-icon-d-arrow-left
el-icon-d-arrow-right
el-icon-video-pause
el-icon-video-play
el-icon-refresh
el-icon-refresh-right
el-icon-refresh-left
el-icon-finished
el-icon-sort
el-icon-sort-up
el-icon-sort-down
el-icon-rank
el-icon-loading
el-icon-view
el-icon-c-scale-to-original
el-icon-date
el-icon-edit
el-icon-edit-outline
el-icon-folder
el-icon-folder-opened
el-icon-folder-add
el-icon-folder-remove
el-icon-folder-delete
el-icon-folder-checked
el-icon-tickets
el-icon-document-remove
el-icon-document-delete
el-icon-document-copy
el-icon-document-checked
el-icon-document
el-icon-document-add
el-icon-printer
el-icon-paperclip
el-icon-takeaway-box
el-icon-search
el-icon-monitor
el-icon-attract
el-icon-mobile
el-icon-scissors
el-icon-umbrella
el-icon-headset
el-icon-brush
el-icon-mouse
el-icon-coordinate
el-icon-magic-stick
el-icon-reading
el-icon-data-line
el-icon-data-board
el-icon-pie-chart
el-icon-data-analysis
el-icon-collection-tag
el-icon-film
el-icon-suitcase
el-icon-suitcase-1
el-icon-receiving
el-icon-collection
el-icon-files
el-icon-notebook-1
el-icon-notebook-2
el-icon-toilet-paper
el-icon-office-building
el-icon-school
el-icon-table-lamp
el-icon-house
el-icon-no-smoking
el-icon-smoking
el-icon-shopping-cart-full
el-icon-shopping-cart-1
el-icon-shopping-cart-2
el-icon-shopping-bag-1
el-icon-shopping-bag-2
el-icon-sold-out
el-icon-sell
el-icon-present
el-icon-box
el-icon-bank-card
el-icon-money
el-icon-coin
el-icon-wallet
el-icon-discount
el-icon-price-tag
el-icon-news
el-icon-guide
el-icon-male
el-icon-female
el-icon-thumb
el-icon-cpu
el-icon-link
el-icon-connection
el-icon-open
el-icon-turn-off
el-icon-set-up
el-icon-chat-round
el-icon-chat-line-round
el-icon-chat-square
el-icon-chat-dot-round
el-icon-chat-dot-square
el-icon-chat-line-square
el-icon-message
el-icon-postcard
el-icon-position
el-icon-turn-off-microphone
el-icon-microphone
el-icon-close-notification
el-icon-bangzhu
el-icon-time
el-icon-odometer
el-icon-crop
el-icon-aim
el-icon-switch-button
el-icon-full-screen
el-icon-copy-document
el-icon-mic
el-icon-stopwatch
el-icon-medal-1
el-icon-medal
el-icon-trophy
el-icon-trophy-1
el-icon-first-aid-kit
el-icon-discover
el-icon-place
el-icon-location
el-icon-location-outline
el-icon-location-information
el-icon-add-location
el-icon-delete-location
el-icon-map-location
el-icon-alarm-clock
el-icon-timer
el-icon-watch-1
el-icon-watch
el-icon-lock
el-icon-unlock
el-icon-key
el-icon-service
el-icon-mobile-phone
el-icon-bicycle
el-icon-truck
el-icon-ship
el-icon-basketball
el-icon-football
el-icon-soccer
el-icon-baseball
el-icon-wind-power
el-icon-light-rain
el-icon-lightning
el-icon-heavy-rain
el-icon-sunrise
el-icon-sunrise-1
el-icon-sunset
el-icon-sunny
el-icon-cloudy
el-icon-partly-cloudy
el-icon-cloudy-and-sunny
el-icon-moon
el-icon-moon-night
el-icon-dish
el-icon-dish-1
el-icon-food
el-icon-chicken
el-icon-fork-spoon
el-icon-knife-fork
el-icon-burger
el-icon-tableware
el-icon-sugar
el-icon-dessert
el-icon-ice-cream
el-icon-hot-water
el-icon-water-cup
el-icon-coffee-cup
el-icon-cold-drink
el-icon-goblet
el-icon-goblet-full
el-icon-goblet-square
el-icon-goblet-square-full
el-icon-refrigerator
el-icon-grape
el-icon-watermelon
el-icon-cherry
el-icon-apple
el-icon-pear
el-icon-orange
el-icon-coffee
el-icon-ice-tea
el-icon-ice-drink
el-icon-milk-tea
el-icon-potato-strips
el-icon-lollipop
el-icon-ice-cream-square
el-icon-ice-cream-round

其效果如下:
在這里插入圖片描述

二、Button 按鈕

常用的操作按鈕。

2.1 基礎用法

基礎的按鈕用法。

使用type、plain、round和circle屬性來定義 Button 的樣式。
這些屬性的意義如下:

參數 說明 類型 可選值 默認值
type 類型 string primary / success / warning / danger / info / text —
plain 是否樸素按鈕 boolean — false
round 是否圓角按鈕 boolean — false
circle 是否圓形按鈕 boolean — false

<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>

在這里插入圖片描述

2.2 禁用狀態

按鈕不可用狀態。

<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><el-row><el-button plain disabled>樸素按鈕</el-button><el-button type="primary" plain disabled>主要按鈕</el-button><el-button type="success" plain disabled>成功按鈕</el-button><el-button type="info" plain disabled>信息按鈕</el-button><el-button type="warning" plain disabled>警告按鈕</el-button><el-button type="danger" plain disabled>危險按鈕</el-button>
</el-row>

在這里插入圖片描述

2.3 文字按鈕

沒有邊框和背景色的按鈕。

<el-button type="text">文字按鈕</el-button>
<el-button type="text" disabled>文字按鈕</el-button>

在這里插入圖片描述

2.4 圖標按鈕

帶圖標的按鈕可增強辨識度(有文字)或節省空間(無文字)。

設置icon屬性即可,icon 的列表可以參考 Element 的 icon 組件,也可以設置在文字右邊的 icon ,只要使用i標簽即可,可以使用自定義圖標。

<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>

在這里插入圖片描述

2.5 按鈕組

以按鈕組的方式出現,常用于多項類似操作。

使用<el-button-group>標簽來嵌套你的按鈕。

<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>

在這里插入圖片描述

2.6 加載中

點擊按鈕后進行數據加載操作,在按鈕上顯示加載狀態。

要設置為 loading 狀態,只要設置loading屬性為true即可。

<el-button type="primary" :loading="true">加載中</el-button>

在這里插入圖片描述

2.7 不同尺寸

Button 組件提供除了默認值以外的三種尺寸,可以在不同場景下選擇合適的按鈕尺寸。
額外的尺寸:medium、small、mini,通過設置size屬性來配置它們。

<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>

在這里插入圖片描述


總結

在本文中,我們深入了解了Element-ui中的Icon圖標和Button按鈕的基本用法和實用技巧。Icon圖標為頁面添加了更多的視覺元素,使得界面更加生動;而Button按鈕則是用戶與頁面互動的紐帶,通過豐富的配置選項,我們能夠定制出符合項目需求的按鈕樣式。在實際項目中,熟練掌握這兩個組件的用法,將有助于提升前端界面的設計水平,為用戶提供更好的使用體驗。希望本文能夠為你在Element-ui的使用過程中提供一些有益的參考。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/207905.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/207905.shtml
英文地址,請注明出處:http://en.pswp.cn/news/207905.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

AcGeLinearEnt2d::getPerpLine函數

AcGeLinearEnt2d::getPerpLine函數是AutoCAD圖形庫&#xff08;AutoCAD Geometry Library&#xff0c;即AcGe&#xff09;中的一個成員函數&#xff0c;用于獲取一個通過指定點且垂直于當前直線或線性實體的無限長直線。 函數的參數和返回值說明如下&#xff1a; const AcGeP…

js寫旋轉的時鐘動態

目錄 1、css代碼 2.html代碼 3.js代碼 1、css代碼 .box {position: relative;width: 600px;height: 600px;background: url(./images/clock.jpg) no-repeat center;}.hour,.minute,.second {position: absolute;left: 0;top: 0;width: 100%;height: 100%;}.hour {background…

上個月暴漲34.6%后,SoundHound AI股票現在還能買入嗎?

來源&#xff1a;猛獸財經 作者&#xff1a;猛獸財經 揭開SoundHound AI股價波動的原因 S&P Global Market Intelligence的數據顯示&#xff0c;在擺脫了10月份的大幅下跌后&#xff0c;SoundHound AI的股價在11月份實現了34.6%的漲幅。 原因是該公司公布了穩健的第三季…

英文論文查重復率網址

大家好&#xff0c;今天來聊聊英文論文查重復率網址&#xff0c;希望能給大家提供一點參考。 以下是針對論文重復率高的情況&#xff0c;提供一些修改建議和技巧&#xff1a; 英文論文查重復率網址 在撰寫英文論文時&#xff0c;查重是確保論文原創性和質量的重要環節快碼論文…

國產化, 海量數據庫 VastbaseG100 兼容適配

背景&#xff1a; 客戶是國內某家電龍頭企業&#xff0c;應國產化政策要求&#xff0c; 系統需要適配國產數據庫&#xff0c; Vastbase G100 遇到問題&#xff1a; 1. 數據庫連接&#xff1a; Vastbase 是基于 postgresql 進行封裝&#xff0c; 所以理論上是兼容的&#…

Efficient physics-informed neural networks using hash encoding

論文閱讀&#xff1a;Efficient physics-informed neural networks using hash encoding Efficient physics-informed neural networks using hash encoding簡介方法PINN哈希編碼具有哈希編碼的 PINN 實驗Burgers 方程Helmholtz 方程N-S 方程訓練效率對比 總結 Efficient physi…

容器資源視圖隔離 —— 筑夢之路

先做個記錄&#xff0c;抽空再整理 K8s 部署 Lxcfs 準入控制器&#xff0c;實現容器中資源單獨可見 - 「Johny」PlayGround Kubernetes 中利用 LXCFS 控制容器資源可見性 - 碼農教程 容器資源可視化隔離的實現方法_51CTO博客_容器隔離技術 Lxcfs在容器集群中的使用-騰訊云開…

06 JQuery調用接口

文章目錄 一、Qs.js庫介紹1. Qs簡介2. Qs.parse3. Qs.stringify 二、jQuery調用接口1. 增加&#xff08;Create&#xff09;2. 刪除&#xff08;Delete&#xff09;3. 讀取&#xff08;Read&#xff09;4. 更新&#xff08;Update&#xff09; 三、示例 一、Qs.js庫介紹 1. Qs…

代碼隨想錄算法訓練營 --- 第五十九天

今天同樣是單調棧&#xff0c;第二題很重要。 第一題&#xff1a; 簡介&#xff1a; 本題可以說和上一題很是相似&#xff0c;只是有一點不同&#xff0c;數組是循環的。本題有兩種巧妙地解法&#xff0c;都不難。 第一種方法&#xff08;也是第一個想出來的方法&#xff09…

創建自定義Docker鏡像:一步步指南

當創建自定義Docker鏡像時&#xff0c;Dockerfile是關鍵的一環。這篇博客將詳細介紹如何編寫一個Dockerfile&#xff0c;其中包含創建自定義應用程序所需的步驟和示例。讓我們開始吧&#xff1a; 創建自定義Docker鏡像&#xff1a;一步步指南 1. 了解Dockerfile Dockerfile是…

我的acer電腦U盤裝系統前BIOS設置及裝系統過程中的操作

1、開機長按F2進入BIOS設置 2、使能F12 3、調整boot順序&#xff0c;使USB啟動的優先級最高 4、按F10保存退出 5、插入U盤開機&#xff0c;boot選擇界面無需操作&#xff0c;等待幾秒&#xff0c;默認進入U盤系統 由于既使能了F12&#xff0c;又將U盤的優先級進調整到了最高&…

OpenVINS學習1——數據集配置與運行

前言 OpenVINS是基于MSCKF的開源VIO算法&#xff0c;有非常詳細的官網文檔可以學習使用&#xff0c;將來一段時間的主要實踐工作&#xff0c;就是深度掌握這份開源代碼。 https://docs.openvins.com/ 一、環境配置與Euroc數據集運行 我的環境是Ubuntu20.04&#xff0c;ROS1&a…

vue3中實現el-tree通過ctrl或shift批量選擇節點并高亮展示

一、看效果&#xff1a; 按住ctrl鍵實現單個多選 按住shift實現區間范圍多選 二、代碼&#xff1a; vue頁面 <template><el-treeclass"w100%":data"$.treeData"ref"treeTab…

Unity中Batching優化的靜態合批

文章目錄 前言一、靜態合批的規則1、模型使用同一個材質2、勾選靜態合批3、對于靜態合批后的Mesh頂點總數&#xff0c;不超過2^16^即可以使用同一批次&#xff0c;超過則會開啟一個新的批次4、對與使用同一材質的不同模型間&#xff0c;紋理貼圖的問題&#xff0c;我們可以通過…

數據可視化工具選擇:功能、易用性與安全性

作為一名數據可視化大屏設計師&#xff0c;我深知選擇一款合適的數據可視化工具對于提高工作效率和呈現效果的重要性。下面&#xff0c;我將從真正對我們數據可視化大屏設計師有用的角度為大家介紹選擇數據可視化工具的一些必要條件和要求。 1. 功能強大與靈活定制 首先&…

高并發場景下的httpClient使用優化技巧

1. 背景 我們有個業務&#xff0c;會調用其他部門提供的一個基于http的服務&#xff0c;日調用量在千萬級別。使用了httpclient來完成業務。之前因為qps上不去&#xff0c;就看了一下業務代碼&#xff0c;并做了一些優化&#xff0c;記錄在這里。 先對比前后&#xff1a;優化…

如何做好口譯服務,同傳和交傳哪個服務好

隨著中國經濟的蓬勃發展和綜合實力的不斷增強&#xff0c;中國與世界各國的交流也日益頻繁。口譯作為對外交流的橋梁與紐帶&#xff0c;需求量與日俱增&#xff0c;其重要性不言而喻。那么&#xff0c;如何做好口譯服務呢&#xff1f;是同傳還是交傳更好呢&#xff1f; 業內專家…

滲透測試工具AWVS的全面解析

在當今的數字化時代&#xff0c;網絡安全已經成為了企業和個人必須關注的重要問題。為了確保網絡的安全&#xff0c;我們需要使用各種工具和技術進行檢測和防護。其中&#xff0c;滲透測試是一種非常重要的方法&#xff0c;它可以幫助我們發現網絡中的安全漏洞&#xff0c;并采…

機器人純阻抗控制接觸剛性環境

問題描述 在機器人學中&#xff0c;阻抗控制是一種常用的控制策略&#xff0c;用于管理機器人在與環境交互時的運動和力。阻抗控制背后的關鍵概念是將環境視為導納&#xff0c;而將機器人視為阻抗。 純阻抗控制接觸剛性環境時&#xff0c;機器人的行為方式主要受其阻抗參數的…

表單小程序作用體現在哪

表單的用途非常廣泛&#xff0c;它是線上收集信息或用戶預約/需求服務的重要方式&#xff0c;對商家來說如今線上平臺非常多&#xff0c;生意開展的形式也越來越多&#xff0c;比如常見的預約、報名、收款、產品支付等都可以通過表單實現。 接下來啊讓我們看看通過【雨科】平臺…