Element-plus使用记录

Element-plus使用中遇到的问题与解决方案

动态渲染icon

Element-plus中的icon需要单独安装
Icon 图标 | Element Plus

<template>
  <div class="page">
    <div class="h-menu">
      <div class="show-menu" @click="isCollapseHandle">
        <el-icon v-if="isCollapse"><Expand /></el-icon>
        <el-icon v-else><Fold /></el-icon>
      </div>
      <el-menu default-active="1" :collapse="isCollapse" :router="true">
        <el-menu-item v-for="item in menuList" :key="item.id" :index="item.path">
          <el-icon>
            <component :is="item.icon"></component>
          </el-icon>
          <template #title>{{ item.name }}</template>
        </el-menu-item>
      </el-menu>
    </div>

    <main>
      <RouterView />
    </main>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isCollapse: true,
      menuList: [
        {
          id: '1',
          name: 'menu-1',
          path: '/',
          icon: 'Files'
        },
        {
          id: '2',
          name: 'menu-2',
          path: 'test_path',
          icon: 'User'
        },
        {
          id: '3',
          name: 'menu-3',
          path: 'test_path',
          icon: 'SwitchButton'
        }
      ]
    }
  }
}
</script>

<style lang="less" scoped></style>

 

相关推荐

  1. Element-plus使用记录

    2024-04-25 09:22:01       15 阅读
  2. vue项目使用element-plus

    2024-04-25 09:22:01       30 阅读
  3. 使用Element-Plus 加载style

    2024-04-25 09:22:01       34 阅读
  4. Element-plus使用中遇到的问题

    2024-04-25 09:22:01       13 阅读
  5. element-plus ui的使用说明

    2024-04-25 09:22:01       14 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-25 09:22:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-25 09:22:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-25 09:22:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-25 09:22:01       20 阅读

热门阅读

  1. FFmpeg常用实例详解

    2024-04-25 09:22:01       14 阅读
  2. watchEffect的使用

    2024-04-25 09:22:01       14 阅读
  3. IDEA->EasyCode(mapper.xml) 字段无逗号分割问题

    2024-04-25 09:22:01       16 阅读
  4. 执法记录仪如何防抖

    2024-04-25 09:22:01       13 阅读
  5. TiDB-PCTP考试复习

    2024-04-25 09:22:01       15 阅读
  6. STM32_警报装置

    2024-04-25 09:22:01       12 阅读
  7. 开发语言漫谈-ABAP

    2024-04-25 09:22:01       14 阅读
  8. 常用的机器学习模型算法

    2024-04-25 09:22:01       12 阅读
  9. C#算法之冒泡排序算法

    2024-04-25 09:22:01       13 阅读