欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue3無法顯示element-plus問題及解決

 更新時(shí)間:2024年03月20日 15:27:09   作者:SwaryLA  
這篇文章主要介紹了vue3無法顯示element-plus問題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

vue3無法顯示element-plus

原本想使用el-tree做目錄,結(jié)果找了很久的原因都無法顯示,并且沒有任何報(bào)錯(cuò),但是在調(diào)試的過程中發(fā)現(xiàn)el-tree使用的數(shù)據(jù)是對(duì)象形式的

并且還報(bào)了el-tree組件無法解析

runtime-core.esm-bundler.js:38 [Vue warn]: Failed to resolve component: el-tree If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

剛開始以為需要解析數(shù)據(jù),但是其他人都可以正常使用,所以嘗試放其他組件,結(jié)果其他組件也都無法使用,那么很有可能是掛載出現(xiàn)問題

因?yàn)閷⑺行枰獟燧d使用的變量放在了一個(gè)use里導(dǎo)致的,還是得多熟悉才行

正確使用方法

vue3使用Element-plus的圖標(biāo)

首先安裝Element-Plus-icon

# 選擇一個(gè)你喜歡的包管理器
 
# NPM
$ npm install @element-plus/icons-vue
# Yarn
$ yarn add @element-plus/icons-vue
# pnpm
$ pnpm install @element-plus/icons-vue

如何使用

Element-Plus-icon官方文檔鏈接

https://element-plus.org/zh-CN/component/icon.html#icon-collection

在main.ts中引入Element-Plus-icon

import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 
Object.keys(ElementPlusIconsVue).forEach((key) => {
    app.component(key, ElementPlusIconsVue[key])
})
  • 第一種直接點(diǎn)擊圖標(biāo)復(fù)制<el-icon>
<el-icon><ArrowRight /></el-icon>
  • 第二種通過icon="el-icon-plus" 
<el-button type="success" icon="el-icon-plus" >
    1111
</el-button>
  • 第三種通過SVG
<template>
  <div style="font-size: 20px">
    <!-- 由于SVG圖標(biāo)默認(rèn)不攜帶任何屬性 -->
    <!-- 你需要直接提供它們 -->
    <Edit style="width: 1em; height: 1em; margin-right: 8px" />
    <Share style="width: 1em; height: 1em; margin-right: 8px" />
    <Delete style="width: 1em; height: 1em; margin-right: 8px" />
    <Search style="width: 1em; height: 1em; margin-right: 8px" />
  </div>
</template>

總結(jié)

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

相關(guān)文章

最新評(píng)論