Is there a way to open Razor component in Visual Studio with environment with dual screens . I'll love to have markup on one screen and @code {}
section on other. While MVC developing usually markup is on one screen while JS is on other. Switching to Blazor C# replaces JS,But my mind is still mapped to read markup from one while is code on other.
Can we create component with code separated from markp but still connected.
您可以使用后面的代码partial class
:
我的组件.razor
<h1>Thi is a component @Title</h1>
MyComponent.razor.cs
public partial class MyComponent
{
[Parameter]
public string Title { get; set; }
}
这是3.1的未来,3.1之前你不能使用partial class
be 继承自派生类Microsoft.AspNetCore.Components.ComponenBase
3.1之前
我的组件.razor
@inherits MyComponentModel
<h1>Thi is a component @Title</h1>
MyComponent.razor.cs
using Microsoft.AspNetCore.Components;
public class MyComponentModel : ComponentBase
{
[Parameter]
public string Title { get; set; }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)