【问题标题】:nextjs image into svgnextjs 图像转换成 svg
【发布时间】:2022-11-10 23:08:25
【问题描述】:

如何将 png 图像导入 nextJS svg 组件。

这是我正在使用的示例代码。

<Page title="Logo Designer" className="max-w-xl">
   <div>
        <svg id="logoDesigner" width={700} height={600} style={{ backgroundColor: 'lightgray' }}>
             <rect class="draggable" x="4" y="5" width="80" height="100" fill="#007bff" />
             <rect class="draggable" x="18" y="5" width="80" height="400" fill="#888" />
        </svg>
   </div>
</Page>

【问题讨论】:

    标签: reactjs svg next.js


    【解决方案1】:

    你可以使用图片标签

     <image
            width="100"
            height="100"
            xlink:href="my-logo.png"
    />
    

    确保根据您的需要更改 width heightxlink:href

    【讨论】:

      猜你喜欢
      • 2017-04-22
      • 2012-12-04
      • 1970-01-01
      • 2015-06-20
      • 1970-01-01
      • 2022-10-08
      • 2016-10-05
      • 2020-02-10
      • 2014-05-13
      相关资源
      最近更新 更多