小编smj*_*smj的帖子

在 Blazor 的父组件中获取子组件绑定值

假设名为 cinput.cshtml 的子组件是

<input type="text" bind="@username">

@functions{
string username;
}
Run Code Online (Sandbox Code Playgroud)

和名为 pform.cshtml 的父组件

<cinput></cinput>
<input type="text" bind="@email">
<input type="button" onclick="@onsubmit">

@functions{

string email;

public void onsubmit(){
   //Call api
}
}
Run Code Online (Sandbox Code Playgroud)

所以问题是如何在父组件中获取用户名值?

c# blazor

9
推荐指数
2
解决办法
9570
查看次数

标签 统计

blazor ×1

c# ×1