InteractiveNavigationComponent.razor 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. @inject NavigationManager Navigation
  2. <button type="button" id="navigate-to-another-page" @onclick="NavigateToAnotherPage">Navigate to another page</button>
  3. <br />
  4. <button type="button" id="refresh-with-navigate-to" @onclick="RefreshWithNavigateTo">Perform enhanced refresh with @(nameof(NavigationManager.NavigateTo))</button>
  5. <br />
  6. <button type="button" id="reload-with-navigate-to" @onclick="ReloadWithNavigateTo">Perform page reload with @(nameof(NavigationManager.NavigateTo))</button>
  7. <br />
  8. <button type="button" id="refresh-with-refresh" @onclick="RefreshWithRefresh">Perform enhanced page refresh with @(nameof(NavigationManager.Refresh))</button>
  9. <br />
  10. <button type="button" id="reload-with-refresh" @onclick="ReloadWithRefresh">Perform page reload with @(nameof(NavigationManager.Refresh))</button>
  11. @code {
  12. private void NavigateToAnotherPage()
  13. {
  14. Navigation.NavigateTo("nav");
  15. }
  16. private void RefreshWithNavigateTo()
  17. {
  18. Navigation.NavigateTo(Navigation.Uri, replace: true);
  19. }
  20. private void ReloadWithNavigateTo()
  21. {
  22. Navigation.NavigateTo(Navigation.Uri, forceLoad: true, replace: true);
  23. }
  24. private void RefreshWithRefresh()
  25. {
  26. Navigation.Refresh();
  27. }
  28. private void ReloadWithRefresh()
  29. {
  30. Navigation.Refresh(forceReload: true);
  31. }
  32. }