Redirecting in blazor with parameter

前端 未结 2 1174
粉色の甜心
粉色の甜心 2020-12-20 14:50

Hello how can you redirect to another page in Blazor with a parameter?

@page \"/auth\"
@using Microsoft.AspNetCore.Blazor.Services;
@inject Auth         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 15:08

    You can only pass parameters in the URL at present.

    So, if your home component was expecting [Parameter] string Name you would need to provide a URL of /home/fred and fred would be passed into the Name parameter of the home component.

    If you are looking to pass more complex data then you would have to look at doing it via some kind of service.

    Here is the link to the official docs on routing parameters: https://blazor.net/docs/routing.html#route-parameters

提交回复
热议问题