You could serialize the list :
Calling Component
<a href="/somepage/@param1/@param2/@param3/@param4">Some Page</a>
@code {
string[] list1 = new[] { "Id1", "FirstName1", "Surname1" };
string[] list2 = new[] { "Id2", "FirstName2", "Surname2", "Value.value", "Value", "Value" };
string[] list3 = new[] { "Id3", "FirstName3", "Surname3", "Value/value", "Value", "Value", "Value", "Value" };
string[] list4 = new[] { "Id4", "FirstName4", "Surname4", "Value-value", "Value", "Value", "Value" };
public string param1 => Serialize(list1);
public string param2 => Serialize(list2);
public string param3 => Serialize(list3);
public string param4 => Serialize(list4);
static string Serialize(string[] source) =>
System.Net.WebUtility.UrlEncode(System.Text.Json.JsonSerializer.Serialize(source));
}
SomePage.razor
@page "/somepage/{List1Json}/{List2Json}/{List3Json}/{List4Json}"
<h3>SomePage</h3>
<ul>
@foreach (var item in List1) { <li>@item</li> }
</ul>
<ul>
@foreach (var item in List2) { <li>@item</li> }
</ul>
<ul>
@foreach (var item in List3) { <li>@item</li> }
</ul>
<ul>
@foreach (var item in List4) { <li>@item</li> }
</ul>
@code {
[Parameter] public string List1Json { get; set; }
[Parameter] public string List2Json { get; set; }
[Parameter] public string List3Json { get; set; }
[Parameter] public string List4Json { get; set; }
public string[] List1 => Deserialize(List1Json);
public string[] List2 => Deserialize(List2Json);
public string[] List3 => Deserialize(List3Json);
public string[] List4 => Deserialize(List4Json);
static string[] Deserialize(string source)
=> System.Text.Json.JsonSerializer.Deserialize<string[]>(System.Net.WebUtility.UrlDecode(source));
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…