js中两种定时器的设置及清除【清除当前的定时器很有效】

https://www.cnblogs.com/Dream2hc/p/web23863.html

var timer = window.setInterval( () => {
                    let error = this.$v.username.$error ||
                        this.$v.email.$error ||
                        this.$v.password.$error ||
                        this.$v.password_again.$error ||
                        this.$v.mnemonic.$error;
                    if (error) {
                        this.reg_bool = true;
                    } else {
                        this.reg_bool = false;
                        clearInterval( timer );
                    }
                }, 1000 );

猜你喜欢

转载自blog.csdn.net/weixin_43343144/article/details/89635736