什么是 Asp.Net Core TagHelper 相当于 Html.ActionLink with script

What is the Asp.Net Core TagHelper equivalent of Html.ActionLink with script

我想在删除前提示一个确认对话框。我在此处找到了 this 非常有效的答案

@Html.ActionLink(
          "Delete",
          "Delete",
          new { id = post.OriginalPost.ID },
          new { onclick = "return confirm('Are you sure you wish to delete this post?');" });

但据我了解,核心一应该避免使用 ActionLinks。那么有没有标签助手或不同的方法来做到这一点?

您通常会使用 AnchorTagHelper:

<a asp-action="Delete" asp-route-id="@post.OriginalPost.ID" 
    onclick="return confirm('Are you sure you wish to delete this post?');">Delete</a>