亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

vue3無法顯示element-plus

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

并且還報了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ù),但是其他人都可以正常使用,所以嘗試放其他組件,結果其他組件也都無法使用,那么很有可能是掛載出現(xiàn)問題

因為將所有需要掛載使用的變量放在了一個use里導致的,還是得多熟悉才行

正確使用方法

vue3使用Element-plus的圖標

首先安裝Element-Plus-icon

# 選擇一個你喜歡的包管理器
 
# 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])
})
  • 第一種直接點擊圖標復制<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圖標默認不攜帶任何屬性 -->
    <!-- 你需要直接提供它們 -->
    <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>

總結

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

相關文章

最新評論