我的页面上有以下 EditForm 模型:
<EditForm Model="@projectParameters" OnValidSubmit="@SubmitProject">
<MatButton Raised="true" Type="submit" Disabled="@saveButtonDisabled">@saveButtonName</MatButton>
</EditForm>
然后是以下功能:
private async Task SubmitProject()
{
DisableSave();
if (pageType == "Create")
{
await CreateProject();
}
else if (pageType == "Create")
{
await EditProject();
}
}
和
void DisableSave()
{
saveButtonDisabled = true;
saveButtonName = "Saving...";
StateHasChanged();
}
SubmitProject & DisableSave 被正确调用,但是当 CreateProject 工作时 saveButtonName & disabled 从未真正显示为已完成。我错过了什么?