force while循环等待settimeout

问题描述 投票:0回答:0
$w.onReady(function () {
    let n = 0;

    do {
        setTimeout(() => $w('#z').changeState('State3'), 2000);
        setTimeout(() => $w('#z').changeState('State4'), 4000);
        n++

    } while (n > 3);
});

changestate 代码行只执行一次因为 while 不等待超时

我读了答案,但我写不正确,我正在使用 wix

javascript loops while-loop settimeout
© www.soinside.com 2019 - 2024. All rights reserved.