Skip to content
Discussion options

You must be logged in to vote
@if (Model.Student != null)
{
    <BootstrapInput @bind-value="@Model.Student.Name" DisplayText="名称"></BootstrapInput>
    <BootstrapInput @bind-value="@Model.Student.Fullname" DisplayText="全称"></BootstrapInput>
}
else
{
    <p>正在加载学生信息...</p>
}

@code {
    [Parameter, NotNull, EditorRequired]
    public TestFoo? Model { get; set; }

    [Parameter]
    public EventCallback<TestFoo> ModelChanged { get; set; }

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        if (Model.Id > 0)
        {
            // 模拟从数据库加载已有数据
            Model.Student = await GetSutdent();
        }
    }

    private async Task<TestStudent> GetSutdent()
 …

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

Tony-ST0754
Jan 17, 2026
Collaborator Author

You must be logged in to vote
0 replies
Comment options

Tony-ST0754
Jan 17, 2026
Collaborator Author

You must be logged in to vote
0 replies
Comment options

Tony-ST0754
Jan 17, 2026
Collaborator Author

You must be logged in to vote
0 replies
Comment options

Tony-ST0754
Jan 17, 2026
Collaborator Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ArgoZhang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
chore This are tasks or bot action
2 participants
Converted from issue

This discussion was converted from issue #7534 on January 17, 2026 04:38.