Developing Blazor Razor component in VS with dual screens

前端 未结 1 1421
南方客
南方客 2021-01-13 12:21

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 oth

1条回答
  •  粉色の甜心
    2021-01-13 12:35

    You can use the code behind with a partial class :

    MyComponent.razor

    Thi is a component @Title

    MyComponent.razor.cs

    public partial class MyComponent
    {
          [Parameter]
          public string Title { get; set; }
    }
    
    

    This is a 3.1 future, before 3.1 you cannot use partial class be inherits from class deriving from Microsoft.AspNetCore.Components.ComponenBase

    before 3.1

    MyComponent.razor

    @inherits MyComponentModel
    

    Thi is a component @Title

    MyComponent.razor.cs

    using Microsoft.AspNetCore.Components;
    
    public class MyComponentModel : ComponentBase
    {
          [Parameter]
          public string Title { get; set; }
    }
    
    
    

    0 讨论(0)
提交回复
热议问题