|
[BUG]
官方UIButton模块,setState方法BUG
[复制链接]
手机:一加5
系统:安卓7.1.1
测试界面代码如下:
apiready=function(){
button = api.require('UIButton');
frameWidth = api.frameWidth;
frameHeight = api.frameHeight;
tWeek = [1,1,1,1,1,1,1];
createButton();
for(var i = 0;i < 7;i++){
if(tWeek == 0){
button.setState({
id: i,
state: 'normal'
});
}else{
button.setState({
id: i,
state: 'active'
});
}
}
}
//创建按钮
function createButton()
{
var buttonTitle = ["周一","周二","周三","周四","周五","周六","周日"];
for(var i=0;i<7;i++){
button.open({
rect: {
x: (1+(3*i))*frameWidth/23,
y: 100,
w: frameWidth*3/23,
h: 30
},
corner: 5,
bg: {
normal: '#C9C9C9',
highlight: '#ff0000',
active: '#ff0000'
},
title: {
size: 14,
//active: buttonTitle,
normal: buttonTitle,
activeColor: '#ffff00',
normalColor: '#000000',
alignment: 'center'
},
fixedOn: api.frameName,
fixed: true
}, function(ret, err) {
console.log("ret="+JSON.stringify(ret)+" err="+JSON.stringify(err));
});
}
}
按此代码,正常情况下,每次进入测试界面,应该7个按钮都处于active状态,实际情况下,随机出现某一个或几个按钮处于normal状态,见附件视频。此问题大概率出现,十次出现个七八次。
|
|