【发布时间】:2024-04-10 14:45:01
【问题描述】:
我正在构建我的页面,我想知道是否可以让我的生活更轻松,并在方法中放置一些简单的自定义输入框,然后它们会将我的值的引用传递给它们
<div class="col-12 row">
<label class="col-2">@Caption</label>
<InputNumber class="form-control col-3" @bind-Value="@Value"/>
</div>
<br />
@code {
[Parameter]
public string Caption { get; set; }
[Parameter]
public int Value { get; set; }
}
然后像这样使用它
<CustomInputNumber Caption="Price" Value="@Product.Price" />
可以这样设置值吗?或者传递对象作为参考?感谢您的帮助!
【问题讨论】:
标签: c# asp.net-core web-applications components blazor