Replacement for @helper in ASP.NET Core

后端 未结 8 1551
傲寒
傲寒 2020-11-30 06:35

So far, i don\'t think ViewComponent solves that neither does TagHelper. Is there any replacement to this? Something that takes parameters and retu

8条回答
  •  时光取名叫无心
    2020-11-30 06:47

    How about using partials to recreate reusable tags?

    MyProject/Views/Shared/_foo.cshtml

    @model string
    
    
    @Model

    MyProject/Views/Courses/Index.cshtml

    @{
        Layout = "_Layout";
    }
    
    

提交回复
热议问题