m***@aliyun.com
m***@aliyun.com
  • 发布:2020-09-09 03:57
  • 更新:2020-09-10 12:32
  • 阅读:738

华为mate20 30,扫描框设置style无效

分类:HTML5+

···
var barcode = null;
// 创建Barcode扫码控件
function createBarcode() {
if(!barcode){
barcode = plus.barcode.create('barcode', [plus.barcode.QR], {
top:'100px',
left:'0px',
width: '100%',
height: '500px',
position: 'static'
});
plus.webview.currentWebview().append(barcode);
}
barcode.start();
}
// 更新Barcode扫码控件
function updateBarcode() {
barcode.setStyle({
top:'200px' // 调整扫码控件的位置
});
}
···
类似于这一段代码:

barcode.setStyle({  
		top:'200px'		// 调整扫码控件的位置  
	});

ios(6s)可以生效,华为mate20、30失效

2020-09-09 03:57 负责人:无 分享
已邀请:
DCloud_Android_ST

DCloud_Android_ST

怎么判断是失效。

  • m***@aliyun.com (作者)

    6s setStyle height width top 都会变化

    华为的无变化


    thisPage.barCode.setStyle({  
    frameColor: "#55aa00",
    scanbarColor: "#ffaa00",
    width: '100%',
    position: 'absolute',
    height: '100%',
    })

    thisPage.barCode是对象,我尝试了setFlash(true)闪光灯华为是好的,说明对象没问题

    我又把当前webview的子窗口个数children(),华为console出来是0个

    但其实我都已经一个一个append进来了


    onLoad: function(e) {  
    //#ifdef APP-PLUS
    this.currentWebview = this.$mp.page.$getAppWebview()
    this.setBarCode(this.currentWebview)
    this.setNotice(this.currentWebview)
    this.setLight(this.currentWebview)
    this.setSwitchBtn(this.currentWebview)
    //#endif
    }

    2020-09-09 19:28

DCloud_Android_ST

DCloud_Android_ST

HX用的什么版本呢 云打包还是离线打包

  • m***@aliyun.com (作者)

    真机测试,没有打包,这个会有不同吗?2.7.9和最新的2.8.11都有这个问题


    2020-09-09 20:11

  • m***@aliyun.com (作者)

    我来试下云打包


    2020-09-09 20:16

  • m***@aliyun.com (作者)

    还是不行,你看我传的短视频,在切换回扫码的时候同时打开了闪光灯,并且把barcode中心移动隐藏起来好放input的View,但是华为在切换的时候只开了闪光灯,苹果都搞定了


    2020-09-09 23:48

  • m***@aliyun.com (作者)

    https://v.youku.com/v_show/id_XNDg0ODgwNzc3Ng==.html?spm=a2hzp.8244740.0.0


    iphone 6s


    2020-09-10 00:21

  • m***@aliyun.com (作者)

    https://v.youku.com/v_show/id_XNDg0ODgwNjkyOA==.html?spm=a2hzp.8244740.0.0


    huawei


    2020-09-10 00:22

DCloud_Android_ST

DCloud_Android_ST

应该是宽高都设置了百分百 全屏了所以top 失效了 你可以测试 将barcode宽高写小 再试试吧

  • m***@aliyun.com (作者)

    连frameColor和scanbarColor都不会变,而6s都会变,我怀疑会不会是setStyle这个未实现?


    2020-09-11 04:49

  • DCloud_Android_ST

    回复 m***@aliyun.com: 完整的示例提供一下 我们看看吧


    2020-09-15 11:05

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