gpt4 book ai didi

Angular Material 的 matTooltip 在重定向到另一个页面后不会消失

转载 作者:行者123 更新时间:2023-12-02 03:26:16 26 4
gpt4 key购买 nike

正如标题所说,如果我按下一个附加了工具提示的按钮并将我重定向到另一个页面,那么 matTooltip 不会消失。显示工具提示并将我重定向到其他页面,但工具提示在同一位置仍然可见。我知道我需要将“trigger”值从“focus”更改为“hover”,但我找到的解决方案都是使用jQuery。有没有办法在 TypeScript/Angular 中做到这一点?

编辑:

这就是我的按钮的样子:

  <button type="button"
#tooltip="matTooltip"
class="close pull-right cogs-properties"
matTooltip="Edit button"
(mouseenter)="tooltip.hide()"
(click)="onEditPage(page)"
aria-label="Edit">
<span class="fa fa-cog" aria-hidden="true"></span>
</button>

这是 editPage 函数:

  onEditPage(page) {
this.selectedPageForEditing = page;
this.editPageService.sendPage({
pageName: page["name"],
templateId: page["value"]["templateId"]
});
this.router.navigate([".../page"]);
}

最佳答案

因此,经过一些深入搜索后,我发现当您将 RouteReuseStrategy 与工具提示一起使用时(这正是我正在使用的),导航到另一个页面后工具提示不会消失。目前,还没有使用 Typescript/Angular 功能来解决此问题,而只能使用 jQuery。以下链接解决了完全相同的问题并提供了解决方案:https://github.com/angular/material2/issues/11478#issuecomment-420164916

关于Angular Material 的 matTooltip 在重定向到另一个页面后不会消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53299991/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com