[英]Dynamic Data On Blazorise Modal - Blazor
Im Using Blazorise on a Blazor Page (Server-Side), and in the modal im working with:我在 Blazor 页面(服务器端)上使用 Blazorise,并在我使用的模态中:
@bind-Value="@myVariable"
// @bind-SelectedValue="@myVariable"
@bind-Value="@myVariable"
// @bind-SelectedValue="@myVariable"
And when i want to use myVariable on the following fields for a calculate calling a method, my variable never updates.当我想在以下字段上使用 myVariable 进行计算调用方法时,我的变量永远不会更新。 Example
例子
<Field>
<FieldLabel>Calculate</FieldLabel>
<Select TValue="float" @bind-SelectedValue="@myVariable">
<SelectItem Value="7">7</SelectItem>
<SelectItem Value="21">21</SelectItem>
</Select>
</Field>
Then when i want to use myVariable it doesn't get the value (7 or 21)然后当我想使用myVariable它没有得到值(7或21)
What can i do, when i change the "myVariable" to set the new value当我更改“myVariable”以设置新值时,我该怎么办
Check This检查这个
<Field>
<FieldLabel>Calculate</FieldLabel>
<Select TValue="float" SelectedValue="@myVariable" SelectedValueChanged="@OnSelectedVariableChanged" >
<SelectItem Value="0">0</SelectItem>
<SelectItem Value="21">21</SelectItem>
</Select>
</Field>
Then in Code do the following:然后在代码中执行以下操作:
@code{
Task OnSelectedVariableChanged (float value)
{
myVariable = value;
return Task.CompletedTask;
}
}
That should Work as "dynamic value" setting it manually the new value when it change这应该作为“动态值”在它更改时手动设置新值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.