SSvg2.js 572 B

12345678910111213141516171819
  1. const r = `<template>\r
  2. <svg aria-hidden="true" :width="size" :height="size" :fill="color">\r
  3. <use :xlink:href="\`#icon-\${name}\`" />\r
  4. </svg>\r
  5. </template>\r
  6. <script setup>\r
  7. defineProps({\r
  8. // 雪碧图里的图标 id(不带 icon- 前缀,对应 <symbol id="icon-xxx">)\r
  9. name: { type: String },\r
  10. // 图标尺寸,宽高取同一个值;不传时由外部 CSS 控制\r
  11. size: { type: [String, Number] },\r
  12. // 填充色;不传则用 currentColor 跟随文字颜色\r
  13. color: { type: String }\r
  14. })\r
  15. <\/script>\r
  16. `;
  17. export {
  18. r as default
  19. };