我的clearTimeout()有问题,它没有清除任何内容

时间:2019-08-23 17:04:31

标签: javascript timeout cleartimeout

我正在尝试使用指纹设计制作一个不错的确认页面,当您将指纹悬停在“加载”上时,会为其添加颜色,如果您将鼠标从指纹上取下,它将变成红色,表示失败,如果按住2秒钟,它将显示为绿色,这是计时器问题。如果我快速将svg悬停然后移开鼠标,它将运行该功能。

我试图将加载变量移到函数之外,但是没有用。我试图将其放在ready()中,但仍然无法正常工作。

更新:我尝试调试,尽管我做了console.log并且显示了错误的信息,但是openUserApp(): void { // get the data from the server this.patientRestService.getModelAppointment().subscribe(result => { // when the dataset is empty, stop opening the dialog if (!result || !result.length) { return; } // open the dialog, by passing the appointments through the data attribute const dialogRef = this.dialog.open(DialogAppComponent, { width: '250px', // THE DATA ATTRIBUTE data: { appointments: result } }); dialogRef.afterClosed().subscribe(result => { console.log('The dialog was closed'); }); }) } 似乎不起作用。

更新2:已修复!好像hasClass不是字符串,我只是删除了“”即可。

if($('.fingerprint').hasClass('approved') === "false")

我希望2秒钟后颜色不会变为绿色,除非您将鼠标悬停在SVG上,我没有任何错误,但是clearTimeout()显然不起作用。

0 个答案:

没有答案