8***@qq.com
8***@qq.com
  • 发布:2025-11-19 10:47
  • 更新:2025-11-19 11:14
  • 阅读:27

本地svg图片在小程序显示了

分类:uni-app

文档上写的小程序端svg只支持线上的路径,为什么我试的本地路径也显示呢手机预览也显示,可以直接使用吗?会不会发布正式版就不显示了呢?

2025-11-19 10:47 负责人:无 分享
已邀请:
DCloud_UNI_JBB

DCloud_UNI_JBB

你怎么写的?

  • 8***@qq.com (作者)


    <image :src="baseUrl + iconUrl + '.svg'"

    style="[
    { width: (Array.isArray(size) ? size[0] : size || width) + 'rpx' },

    { height: (Array.isArray(size) ? size[1] : size || height) + 'rpx' }

    ]"

    ></image>


    直接渲染和动态引入都显示。

    const baseUrl = ref('/NEUIKit/static/img/')

    2025-11-19 13:34

  • 8***@qq.com (作者)

    <image src="/NEUIKit/static/img/aite.svg"  
    :style="[
    { width: (Array.isArray(size) ? size[0] : size || width) + 'rpx' },
    { height: (Array.isArray(size) ? size[1] : size || height) + 'rpx' }
    ]"
    ></image>

    2025-11-19 13:36

  • DCloud_UNI_JBB

    回复 8***@qq.com: 应该没啥问题,保险起见,你可以构建线上测试版本验证下

    2025-11-19 16:02

要回复问题请先登录注册