当前位置: 首页 > news >正文

web前端之若依框架图标对照表、node获取文件夹中的文件名,并通过数组返回文件名、在html文件中引入.svg文件、require、icon

MENU

  • 前言
  • 效果图
  • html
  • JavaScrip
  • style
  • node获取文件夹中的文件名


前言

需要把若依原有的icon的svg文件拿到哦!
注意看生成svg的路径。


效果图

svg


html

<div id="idSvg" class="svg_box"></div>

JavaScrip

let listSvg = ['404', 'bug', 'build', 'button', 'cascader', 'chart', 'checkbox', 'client', 'clipboard', 'code', 'color', 'component', 'dashboard', 'date-range', 'date', 'dict', 'documentation', 'download', 'drag', 'druid', 'edit', 'education', 'email', 'example', 'excel', 'exit-fullscreen', 'eye-open', 'eye', 'form', 'fullscreen', 'github', 'guide', 'icon', 'input', 'international', 'job', 'language', 'link', 'list', 'lock', 'log', 'logininfor', 'message', 'money', 'monitor', 'nacos', 'nested', 'number', 'online', 'password', 'pdf', 'people', 'peoples', 'phone', 'post', 'qq', 'question', 'radio', 'rate', 'redis', 'row', 'search', 'select', 'sentinel', 'server', 'shopping', 'size', 'skill', 'slider', 'star', 'swagger', 'switch', 'system', 'tab', 'table', 'textarea', 'theme', 'time-range', 'time', 'tool', 'tree-table', 'tree', 'upload', 'user', 'validCode', 'wechat', 'zip'];function initSvg(arr) {let elStr = '';for (let i = 0; i < arr.length; i++) {let item = arr[i];elStr += `<div class="svg_item"><object data="./svg/${item}.svg"></object><div class="title">${item}</div></div>`;}idSvg.innerHTML = elStr;
}initSvg(listSvg);

style

body {margin: 0;background-color: #cecece;
}::-webkit-scrollbar {width: 0;
}::-webkit-scrollbar-horizontal {display: none;
}::-webkit-scrollbar-thumb {display: none;
}.svg_box {padding: 6px;box-sizing: border-box;display: grid;grid-template-columns: 50% 50%;grid-gap: 10px;
}.svg_item {border: 1px solid rgb(70, 130, 180);padding: 6px;box-sizing: border-box;display: flex;flex-direction: column;align-items: center;
}.title {margin-top: 8px;font-weight: 700;font-size: 18px;
}

node获取文件夹中的文件名

const fs = require('fs');
const path = require('path');// 替换为你的文件夹路径
const folderPath = './svg';// 读取文件夹中的文件
fs.readdir(folderPath, (err, files) => {if (err) return err;// 过滤掉文件夹,只保留文件const fileNames = [];fileNames = files.filter(file => fs.statSync(path.join(folderPath, file)).isFile());console.log('File names in the folder:', JSON.stringify(fileNames));
});

执行指令node readFiles.js

http://www.lryc.cn/news/240918.html

相关文章:

  • 使用 goland 开发 golang 项目环境配置
  • Linux宝塔面板搭建Discuz论坛, 并内网穿透实现公网访问
  • [git] 忽略已经提交的文件或文件夹
  • 大模型增量预训练参数说明
  • 成为AI产品经理——模型评估概述
  • 内存屏障与JVM指令
  • 深入理解JVM 类加载机制
  • SpringCloud微服务 【实用篇】| Eureka注册中心、Ribbon负载均衡
  • SpringSecurity+JWT权限认证
  • Tomcat实现WebSocket即时通讯 Java实现WebSocket的两种方式
  • 安全框架springSecurity+Jwt+Vue-2(后端开发)
  • 6.1.webrc媒体协商
  • Android WebView中打开外部超链接无反应
  • JMeter集结点的使用场景以及如何使用?
  • 2023最新面试题
  • shell 脚本的函数和数组
  • 【RocketMq系列-02】RocketMq的架构解析和高性能设计
  • 【数据结构/C++】线性表_单链表的基本操作
  • flink1.13.6版本的应用程序(maven版)
  • 深度学习之四(循环神经网络Recurrent Neural Networks,RNNs)
  • 【论文精读】HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Face
  • 安装gitlab
  • Nginx模块开发之http handler实现流量统计(1)
  • JSP编写自己的第一个WebServlet实现客户端与服务端交互
  • 三、Keil安装芯片包、下载固件库、建立STM32工程模板
  • 微信相框M1-03花屏抢救照片数据
  • 小程序可拖拽按钮
  • ARM裸机-19(NandFlash和iNand)
  • 机器学习/sklearn笔记:MeanShift
  • opencv-简单图像处理