内容模板元素
默认情况下,<template> 标签内的图标不会被添加。 通过将 inTemplates 选项设置为 true,模板内的图标也会被替换。
更多关于 MDN 上的内容模板元素。
Can you spare a moment to take our survey?
Your feedback helps us improve Lucide and make it better for everyone.
默认情况下,<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);