6***@qq.com
6***@qq.com
  • 发布:2020-11-18 09:24
  • 更新:2020-11-19 18:31
  • 阅读:871

【报Bug】static 目录的条件编译 对于 new plus.nativeObj.View('updateView') 下的drawBitmap 无效

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 2.9.10

手机系统: Android

手机系统版本号: Android 11

手机厂商: 小米

手机机型: mix3

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
const params = {  
    version: '1.1.8', // 版本号  
    remake: '1、修复商家详情轮播图不清晰问题\n\n2、新增餐饮多规格可选\n\n3、新增门票选择日历\n\n4、修复若干bug', // 更新内容  
    maskColor: 'rgba(0,0,0,.6)', // 蒙版的背景色  
    heightScale: '1.536585365853659', // 一个 高度等于多少倍宽度  
    width: '80%',  
    backgroundColor: 'rgba(255,0,0)',  
    topImgSrc: '/static/img/update/top.png',  
    textLeft: 20, // 更新内容的左右边距   
    button: {  
        heightScale: '0.1622',  
        bottom: 20,  
        color: 'white', // 颜色  
        backgourndColor: '#F77575', // 背景颜色  
        radius: '10px', // 圆角  
        text: '立即升级',  
        size: '18px'  
    },  
    title: {  
        color: '#000',  
        size: '22px',  
        height: 22,  
        marginTop: 25  
    },  
    content: {  
        color: '#0F0F0F',  
        size: '15px',  
        marginTop: 20,  
        bottom: 20  
    },  
    cancel: true, // 是否可以关闭  
    cancelImgSrc: '/static/img/update/close.png', // 取消图片的地址   
    buttonStates: true, //是否下载中  

}  
const viewStyle = {  
                height: params.height + 'px',  
                width: params.width,  
                left: (100 - params.width.replace('%', '')) / 2 + '%',  
                top: (info.windowHeight - params.height) / 2 + 'px'  
            }  
            view = new plus.nativeObj.View('updateView', viewStyle)  

            // 绘制图片  
            view.drawBitmap(params.topImgSrc, {}, {  
                height: topImgheight + 'px'  
            })

操作步骤:

1、在static目录下新建 app-plus 目录
2、把图片放在 app-plus 目录下
3、使用 new plus.nativeObj.view() 的 drawBitmap 去绘制图片

预期结果:

希望 drawBitmap 的图片路径可以解析获取到 app-plus 目录下的图片

实际结果:

无法获取到 static 目录下的 app-plus 目录下的图片

bug描述:

用 h5+ 的plus api写了更新弹框,因为有用到图片,静态资源只想编译到 app端,在 static 目录下 新建了目录 app-plus , 实际发现app端无法获取到图片

2020-11-18 09:24 负责人:DCloud_UNI_FXY 分享
已邀请:
DCloud_UNI_FXY

DCloud_UNI_FXY

你的目录结构是什么?
如果有app-plus目录,代码里的路径怎么没有包含?要写完整的包含app-plus的目录

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

    已解决,感谢

    2020-11-20 09:56

该问题目前已经被锁定, 无法添加新回复