7***@qq.com
7***@qq.com
  • 发布:2024-05-05 12:41
  • 更新:2024-05-05 12:41
  • 阅读:48

【报Bug】app 中 css 在 after before 中使用 v-bind 引用图片不生效

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 11

手机系统: Android

手机系统版本号: Android 12

手机厂商: 小米

手机机型: k30s

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: CLI

CLI版本号: 3.0.0-4010420240430001

示例代码:
&::after {  
            content: "";  
            display: block;  
            width: 30rpx;  
            height: 30rpx;  

            background: url('/static/index/projectIcon1.svg'); // 生效  

            background: v-bind("'url(' + theme.images.index.projectIcon1 +')'"); // 不生效  

            background-repeat: no-repeat;  
            background-size: 100% 100%;  
            margin-left: 10rpx;  
        }

操作步骤:
    &::after {  
            content: "";  
            display: block;  
            width: 30rpx;  
            height: 30rpx;  

            background: url('/static/index/projectIcon1.svg'); // 生效  

            background: v-bind("'url(' + theme.images.index.projectIcon1 +')'"); // 不生效  

            background-repeat: no-repeat;  
            background-size: 100% 100%;  
            margin-left: 10rpx;  
        }

预期结果:

出现图片

实际结果:

不生效

bug描述:

在 h5 中是好使的,app 在 after before 中不生效。
如果以正常方式写 background: url('/static/index/projectIcon1.svg'); 是生效的。

2024-05-05 12:41 负责人:无 分享
已邀请:

要回复问题请先登录注册