循环插值SVG精灵

问题描述

我一直在尝试找出如何在循环中内插这些svg精灵。 html svg 元素的路径中缺少某些内容。

循环

each feature,slug in public.feature._data
  .feature__wrap
    .feature__image
      svg
        use(xlink:href="/assets/defs.svg#icon-feature-#")
  .feature__content
    h3.feature__title #{ feature.title }
    p.feature__text #{ feature.text }

svg精灵

<symbol id="icon-feature-1" viewBox='0 0 512 512'>
  <desc>Monitor Icon</desc>
  <path d="M 10 10 H 90 V 90 H 10 L 10 10"/>
</symbol>
<symbol id="icon-feature-2" viewBox='0 0 512.004 512.004'>
  <desc>Cellphone Icon</desc>
  <path d="M 10 10 H 90 V 90 H 10 L 10 10"/>
</symbol>
<symbol id="icon-feature-3" viewBox='0 0 64 64'>
  <desc>Gear Icon</desc>
  <path d="M 10 10 H 90 V 90 H 10 L 10 10"/>
</symbol>

注意:我只是使用了随机的svg ,以使其更易于阅读并减少摘要中的字符数

注2:我已经仔细检查了每一个精灵的路径,它可以很好地工作,以便对我插入到代码其他部分中而不循环的其他子对象而言。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...