NavigationManagerExtensions.GetUriWithHash(NavigationManager, String) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne un URI construit à partir d’un Uri hachage ajouté, mis à jour ou supprimé.
public static string GetUriWithHash(this Microsoft.AspNetCore.Components.NavigationManager navigationManager, string hash);
static member GetUriWithHash : Microsoft.AspNetCore.Components.NavigationManager * string -> string
<Extension()>
Public Function GetUriWithHash (navigationManager As NavigationManager, hash As String) As String
Paramètres
- navigationManager
- NavigationManager
L’attribut NavigationManager.
- hash
- String
Chaîne de hachage. S’il est vide, le hachage est supprimé de l’URI.
Retours
URI avec le hachage spécifié.
Remarques
Si hash ce n’est pas le cas #, vous # serez précédé.
Cette méthode est utile lorsque le document diffère de son emplacement, par exemple lorsqu’un baseURI<base> élément est utilisé, car les URL de hachage relatives sont résolues par rapport au baseURIfichier .
@inject NavigationManager Nav
<a href="@Nav.GetUriWithHash("section1")">Go to section 1</a>