最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue安裝Element?Plus全過程

 更新時(shí)間:2024年03月15日 08:45:49   作者:不情不愿  
這篇文章主要介紹了Vue安裝Element?Plus全過程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

Vue安裝Element Plus

Element UI 是一款基于 Vue 的桌面端組件庫(kù),提供了豐富的PC端組件,簡(jiǎn)化了常用組件的封裝,大大降低了開發(fā)難度。

隨著 Vue 版本的更新,Element-UI 2.x 升級(jí)到了Element Plus

使用 Vue CLI 3 需要安裝 Element Plus,具體方式如下:

npm全局安裝

npm install element-plus --save

打開 package.json 文件可以查看是否安裝成功以及安裝的版本信息:

在main.js文件中引入

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
 
const app = createApp(App)
 
app.use(ElementPlus)
app.mount('#app')

基本使用

App.vue

<template>
<div id="app">
 <h2>Element-UI 測(cè)試</h2>
  <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-button>中文</el-button>
  </el-row>
 
  <el-row class="mb-4">
    <el-button plain>Plain</el-button>
    <el-button type="primary" plain>Primary</el-button>
    <el-button type="success" plain>Success</el-button>
    <el-button type="info" plain>Info</el-button>
    <el-button type="warning" plain>Warning</el-button>
    <el-button type="danger" plain>Danger</el-button>
  </el-row>
 
  <el-row class="mb-4">
    <el-button round>Round</el-button>
    <el-button type="primary" round>Primary</el-button>
    <el-button type="success" round>Success</el-button>
    <el-button type="info" round>Info</el-button>
    <el-button type="warning" round>Warning</el-button>
    <el-button type="danger" round>Danger</el-button>
  </el-row>
 
  <el-row>
    <el-button :icon="Search" circle />
    <el-button type="primary" :icon="Edit" circle />
    <el-button type="success" :icon="Check" circle />
    <el-button type="info" :icon="Message" circle />
    <el-button type="warning" :icon="Star" circle />
    <el-button type="danger" :icon="Delete" circle />
  </el-row>
</div>
</template>

運(yùn)行結(jié)果

如下:

官網(wǎng)版本:

可以看到 icon 圖標(biāo)信息并沒有成功顯示。

這是因?yàn)?,圖標(biāo)由在 Element-UI 版本中的樣式,在Element Plus 中被封裝成了一個(gè)個(gè)組件。

安裝圖標(biāo)庫(kù)

npm install @element-plus/icons-vue

然后在main.js中使用for循環(huán)

將圖標(biāo)以組件的形式全部引入:

import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import * as ElIcon from '@element-plus/icons-vue'
 
const app = createApp(App)
 
for (let iconName in ElIcon){
  app.component(iconName, ElIcon[iconName])
}
app.use(ElementPlus)
app.mount('#app')

需要通過標(biāo)簽的方式使用

<el-icon><Search/></el-icon>

App.vue 

<template>
<div id="app">
 <h2>Element-UI 測(cè)試</h2>
 <br>
  <!-- 在組件中使用 -->
  <el-row>
    <el-button circle icon = "Search"></el-button>
    <el-button type="primary" circle icon = "Edit"></el-button>
    <el-button type="success" circle icon = "Check"></el-button>
    <el-button type="info" circle icon = "Message"></el-button>
    <el-button type="warning" circle icon = "Star"></el-button>
    <el-button type="danger" circle icon = "Delete"></el-button>
  </el-row>
  <br>
  <!-- 結(jié)合 el-icon 使用 -->
  <el-row>
    <el-icon><Search/></el-icon>
    <el-icon><Edit/></el-icon>
    <el-icon><Check/></el-icon>
    <el-icon><Message/></el-icon>
    <el-icon><Star/></el-icon>
    <el-icon><Delete/></el-icon>
  </el-row>
</div>
</template>

效果如下:

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vscode配置@路徑提示方式,并解決vue文件內(nèi)失效的問題

    vscode配置@路徑提示方式,并解決vue文件內(nèi)失效的問題

    這篇文章主要介紹了vscode配置@路徑提示方式,并解決vue文件內(nèi)失效的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • vue中的get方法\post方法如何實(shí)現(xiàn)傳遞數(shù)組參數(shù)

    vue中的get方法\post方法如何實(shí)現(xiàn)傳遞數(shù)組參數(shù)

    這篇文章主要介紹了vue中的get方法\post方法如何實(shí)現(xiàn)傳遞數(shù)組參數(shù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-04-04
  • vuex實(shí)現(xiàn)數(shù)據(jù)持久化的兩種方案

    vuex實(shí)現(xiàn)數(shù)據(jù)持久化的兩種方案

    這兩天在做vue項(xiàng)目存儲(chǔ)個(gè)人信息的時(shí)候,遇到了頁(yè)面刷新后個(gè)人信息數(shù)據(jù)丟失的問題,在查閱資料后,我得出兩種解決數(shù)據(jù)丟失,使用數(shù)據(jù)持久化的方法,感興趣的小伙伴跟著小編一起來看看吧
    2023-08-08
  • vue組件值變化但不刷新強(qiáng)制組件刷新的問題

    vue組件值變化但不刷新強(qiáng)制組件刷新的問題

    這篇文章主要介紹了vue組件值變化但不刷新強(qiáng)制組件刷新的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-06-06
  • Vue.js自定義指令的基本使用詳情

    Vue.js自定義指令的基本使用詳情

    這篇文章主要介紹了Vue.js自定義指令的基本使用詳情,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值需要的小伙伴可以參考一下
    2022-05-05
  • Vue監(jiān)聽localstorage變化的方法詳解

    Vue監(jiān)聽localstorage變化的方法詳解

    在日常開發(fā)中,我們經(jīng)常使用localStorage來存儲(chǔ)一些變量,這些變量會(huì)存儲(chǔ)在瀏覽中,對(duì)于localStorage來說,即使關(guān)閉瀏覽器,這些變量依然存儲(chǔ)著,方便我們開發(fā)的時(shí)候在別的地方使用,本文就給大家介紹Vue如何監(jiān)聽localstorage的變化,需要的朋友可以參考下
    2023-10-10
  • el-form-item表單label添加提示圖標(biāo)的實(shí)現(xiàn)

    el-form-item表單label添加提示圖標(biāo)的實(shí)現(xiàn)

    本文主要介紹了el-form-item表單label添加提示圖標(biāo)的實(shí)現(xiàn),我們將了解El-Form-Item的基本概念和用法,及添加提示圖標(biāo)以及如何自定義圖標(biāo)樣式,感興趣的可以了解一下
    2023-11-11
  • vue中跳轉(zhuǎn)界面的3種實(shí)現(xiàn)方法

    vue中跳轉(zhuǎn)界面的3種實(shí)現(xiàn)方法

    這篇文章主要給大家介紹了關(guān)于vue中跳轉(zhuǎn)界面的3種實(shí)現(xiàn)方法,文中通過實(shí)例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-07-07
  • 如何通過Vue3+Element?Plus自定義彈出框組件

    如何通過Vue3+Element?Plus自定義彈出框組件

    這篇文章主要給大家介紹了關(guān)于如何通過Vue3+Element?Plus自定義彈出框組件的相關(guān)資料,彈窗是前端開發(fā)中的一種常見需求,文中通過代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2024-05-05
  • 解決iView中時(shí)間控件選擇的時(shí)間總是少一天的問題

    解決iView中時(shí)間控件選擇的時(shí)間總是少一天的問題

    下面小編就為大家分享一篇解決iView中時(shí)間控件選擇的時(shí)間總是少一天的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-03-03

最新評(píng)論

浏阳市| 九台市| 武安市| 顺昌县| 厦门市| 霍邱县| 泽普县| 额济纳旗| 疏附县| 星子县| 高密市| 合川市| 香河县| 招远市| 石阡县| 汉中市| 阜新市| 新田县| 清水河县| 博野县| 杭锦后旗| 丰都县| 读书| 读书| 茶陵县| 和顺县| 莎车县| 自贡市| 五峰| 田东县| 漾濞| 镇赉县| 义乌市| 平罗县| 秦皇岛市| 赤水市| 关岭| 花莲市| 明光市| 白城市| 辛集市|