首页 > 其他分享 >Blazor笔记-Component RenderFragment / ChildContent

Blazor笔记-Component RenderFragment / ChildContent

时间:2024-03-07 15:33:05浏览次数:17  
标签:Razor Component 笔记 ChildContent RenderFragment Blazor

更新记录

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

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

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

Component RenderFragment / ChildContent

RenderFragment

There are two types of render elements, RenderFragment and RenderFragment<T>. RenderFragment is simply a Razor fragment without any input parameters, and RenderFragment<T> has an input parameter that you can use inside the Razor fragment code by using the context keyword.

ChildContent

<div class="alert alert-primary" role="alert">
 @ChildContent
</div>

@code{
 [Parameter]
 public RenderFragment ChildContent { get; set; } =@<b>This is a default value</b>;
}

标签:Razor,Component,笔记,ChildContent,RenderFragment,Blazor
From: https://www.cnblogs.com/cqpanda/p/17596390.html

相关文章

  • Vue学习笔记36--VueComponent构造函数
    VueComponent构造函数<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>VueComponent&......
  • Blazor使用QuickGrid
    @usingMicrosoft.AspNetCore.Components.QuickGrid<PageTitle>PromotionGrid</PageTitle><h1>PromotionGridExample</h1><QuickGridItems="@people"><PropertyColumnProperty="@(p=>p.PersonId)"Sor......
  • Blazor下载文件
    法一:@usingSystem.IO@injectIJSRuntimeJS<PageTitle>FileDownload1</PageTitle><h1>FileDownloadExample1</h1><button@onclick="DownloadFileFromStream">DownloadFileFromStream</button>@code{pri......
  • Blazor绑定数字
    <h1>DecimalBindingExample</h1><p><label>Decimalvalue(&plusmn;0.000format):<input@bind="DecimalValue"/></label></p><p><code>decimalValue</code>:......
  • Blazor之onclick事件更新值
    <h1>EventHandlerExample1</h1><h2>@headingValue</h2><p><button@onclick="UpdateHeading">Updateheading</button></p><p><label><inputtype="checkb......
  • Blazor常用事件
    一、Input事件:<h1>BindEventExample</h1><p><label>InputValue:<input@bind="InputValue"@bind:event="oninput"/></label></p><p><code>InputValue</cod......
  • Spring @Configuration 和 @Component 区别
    Spring@Configuration和@Component区别一句话概括就是@Configuration中所有带@Bean注解的方法都会被动态代理,因此调用该方法返回的都是同一个实例。 @Configuration注解:@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented@Componentpublic@......
  • Ant for Blazor做单个表的增删查改
    AntforBlazor做单个表的增删查改2024年02月27日花了一天时间弄出来了,基本弄好了,vs2022+blazorserver+net8,引用的AntDesign版本是0.17.4代码里的model和repository是用自己牛腩代码生成器生成的东西,sqlsugar的,记得在program里注入就好相关代码:@page"/Student"@usingSys......
  • MAUI Blazor+MASA开发安卓应用学习笔记 - 设置图标和初始屏幕
    上一期已经成功生成了APK能成功安装到手机上了,图标和初始屏幕很难看,接下来着手修改图标和初始屏幕一、修改图标打开项目文件.csproj,找到以下代码<!--AppIcon--><MauiIconInclude="Resources\AppIcon\appicon.svg"ForegroundFile="Resources\AppIcon\appiconfg.svg"Colo......
  • MAUI Blazor+MASA开发安卓应用学习笔记 - 设置APP格式、名称、版本信息
    上一期说到了如何生成APP应用,生成的文件是AAB格式的,这个格式安装不是很方便,如果能生成APK就好了 一、设置APP格式打开项目文件.csproj,在PropertyGroup下添加属性<AndroidPackageFormat>apk</AndroidPackageFormat>二、设置名称和版本信息在项目文件里,可以设置全局的应用......