tab 切换选中状态有问题,有时是先执行changed再切换选中颜色,有时先切换颜色再执行changed
autostu opened this issue · comments
autostu commented
function sleep(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
$ui.render({
type: "view",
props: {
title: "加解密"
},
views: [{
type: "tab",
props: {
id: "tab",
items:["加密","解密"],
index: 1
},
layout: function(make, view) {
make.top.equalTo(0).offset(10)
},events: {
changed: function(sender) {
var items = sender.items
var index = sender.index
sleep(3000)
$ui.toast(index + ": " + items[index])
}
}
}]
})