内容模板元素
默认情况下,<template> 标签内的图标不会被添加。 通过将 inTemplates 选项设置为 true,模板内的图标也会被替换。
更多关于 MDN 上的内容模板元素。
Lucide V1 发布了!🚀
你现在浏览的是 v1 站点,如需查看 v0,请前往 v0 站点
默认情况下,<template> 标签内的图标不会被添加。 通过将 inTemplates 选项设置为 true,模板内的图标也会被替换。
更多关于 MDN 上的内容模板元素。
createIcons 函数配合 template 元素的示例 import { createIcons, Backpack } from 'lucide/dist/cjs/lucide'; import "./styles.css"; createIcons({ icons: { Backpack, }, inTemplates: true }); const container = document.getElementById("container"); const template = document.getElementById("template"); const firstClone = document.importNode(template.content, true); container.appendChild(firstClone); const secondClone = document.importNode(template.content, true); container.appendChild(secondClone);