Loading

Blazor笔记-Razor

更新记录

注意:非教程。纯笔记,日常查询用的。需要教程的小伙伴找几本书看看即可哈哈,有Vue基础的话非常快,概念都是通的。非工作需要不建议深入学习Blazor,深入Vue吧,用的多,哈哈。

完整目录地址:https://www.cnblogs.com/cqpanda/p/17596348.html

点击查看
2024年3月7日 发布。
2023年8月1日 迁移笔记到博客。

Razor

@page "/xx"                         //路由

@("<div>Panda</div>")                   //纯文本字符串

@((MarkupString)"<span>Hello World</span>")     //HTML文本字符串

@attribute [Authorize]                          //添加特性

@implements IDisposable                         //实现接口

@inherits FatherClass          //继承

@typeparam TItem                                //定义泛型类型

@layout AnotherLayoutFile                       //定义使用的布局

@namespace Another.NameSpace                    //定义命名空间

@using System.IO                                //引用命名空间

@inject WeatherForecastService ForecastService  //注入服务

[Inject]
public WeatherForecastService ForecastService { get; set; } //注入服务(code behind)

@code {                                         //组件的参数
 [Parameter]
 public string Summary { get; set; }
}

@code {
 [Parameter]
 public RenderFragment CustomMessage { get; set; }  //接收传入的HTML/Blazor组件
}

posted @ 2024-03-07 15:33  重庆熊猫  阅读(5)  评论(0编辑  收藏  举报