11@page " /components/calendar"
22
3- <PageHeader Title =" Calendar 日历" >
4- 按照日历形式展示数据或日期的容器。
5- </PageHeader >
6-
7- <LayoutContent AnchorItems =" @(new[]{" 示例 " })" >
3+ <PageLayout Title =" Calendar 日历" Description =" 按照日历形式展示数据或日期的容器。"
4+ Anchors =" @(new[]{" 事项日历面板 " ," 卡片日历 " ," 自定义高亮显示的日期 " ," 自定义日期的范围 " ," 更改每周的第一天 " ," 设置周的文本 " ," 自定义标题 " ," 自定义单元格的内容 " })"
5+ ComponentType =" typeof(TCalendar)" >
86 <Example Title =" 事项日历面板" >
97 <Description >在日期中可显示事项的日期显示容器。常用于有足够空间,且需要承载或显示事项信息时使用。</Description >
108 <RunContent >
1311 <CodeContent >
1412 @Code.Create( @"
1513```cshtml-razor
14+ <TCalendar />
15+ ```
16+ ")
17+ </CodeContent >
18+ </Example >
19+ <Example Title =" 卡片日历" >
20+ <Description ></Description >
21+ <RunContent >
22+ <TCalendar Card />
23+ </RunContent >
24+ <CodeContent >
25+ @Code.Create( @"
26+ ```cshtml-razor
27+ <TCalendar Card />
28+ ```
29+ ")
30+ </CodeContent >
31+ </Example >
32+ <Example Title =" 自定义高亮显示的日期" >
33+ <Description >组件默认高亮“今天”或“当前月份”</Description >
34+ <RunContent >
35+ <TCalendar Multiple SelectedDates =" new(){ new(2023,8,7), new(2023,9,6), new(2023,7,14) }" />
36+ </RunContent >
37+ <CodeContent >
38+ @Code.Create( @"
39+ ```cshtml-razor
40+ <TCalendar Multiple SelectedDates =" " new(){ new(2023,8,7), new(2023,9,6), new(2023,7,14) } " " />
41+ ```
42+ ")
43+ </CodeContent >
44+ </Example >
45+ <Example Title =" 自定义日期的范围" >
46+ <Description >
47+ <code >StartDate</code > 开始日期,<code >EndDate</code > 结束日期,超出范围的日期将不可选中
48+ </Description >
49+ <RunContent >
50+ <TCalendar StartDate =" new(2023,7,1)" EndDate =" new(2024,5,18)" />
51+ </RunContent >
52+ <CodeContent >
53+ @Code.Create( @"
54+ ```cshtml-razor
55+ <TCalendar StartDate =" " new(2023,7,1) " " EndDate =" " new(2024,5,18) " " />
56+ ```
57+ ")
58+ </CodeContent >
59+ </Example >
60+ <Example Title =" 更改每周的第一天" >
61+ <Description ></Description >
62+ <RunContent >
63+ <TCalendar FirstDayOfWeek =" DayOfWeek.Wednesday" />
64+ </RunContent >
65+ <CodeContent >
66+ @Code.Create( @"
67+ ```cshtml-razor
68+ <TCalendar FirstDayOfWeek =" " DayOfWeek.Wednesday " " />
69+ ```
70+ ")
71+ </CodeContent >
72+ </Example >
73+ <Example Title =" 设置周的文本" >
74+ <Description ></Description >
75+ <RunContent >
76+ <TCalendar >
77+ <WeekContent >
78+ @if ( context == DayOfWeek .Sunday )
79+ {
80+ <text >
81+ <span style =" color :red " >星期天</span >
82+ </text >
83+ }
84+ else
85+ {
86+ @( $" 星期{(int )context }" )
87+ }
88+ </WeekContent >
89+ </TCalendar >
90+ </RunContent >
91+ <CodeContent >
92+ @Code.Create( @"
93+ ```cshtml-razor
94+ <TCalendar >
95+ <WeekContent >
96+ @if ( context == DayOfWeek .Sunday )
97+ {
98+ <text >
99+ <span style =" " color:red " " >星期天</span >
100+ </text >
101+ }
102+ else
103+ {
104+ @( $" " 星期{(int )context }" " )
105+ }
106+ </WeekContent >
107+ </TCalendar >
108+ ```
109+ ")
110+ </CodeContent >
111+ </Example >
112+ <Example Title =" 自定义标题" >
113+ <Description ></Description >
114+ <RunContent >
115+ <TCalendar TitleText =" TDesignBlazor 开发计划" />
116+
117+ <TCalendar >
118+ <TitleContent >
119+ <TIcon Name =" IconName.Calendar" /> 2.0发布计划
120+ </TitleContent >
121+ </TCalendar >
122+ </RunContent >
123+ <CodeContent >
124+ @Code.Create( @"
125+ ```cshtml-razor
126+ <TCalendar TitleText =" " TDesignBlazor 开发计划 " " />
127+
128+ <TCalendar >
129+ <TitleContent >
130+ <TIcon Name =" " IconName.Calendar " " /> 2.0发布计划
131+ </TitleContent >
132+ </TCalendar >
133+ ```
134+ ")
135+ </CodeContent >
136+ </Example >
137+ <Example Title =" 自定义单元格的内容" >
138+ <Description ></Description >
139+ <RunContent >
140+ <TCalendar >
141+ <CellContent >
142+ @if ( context .date .Day == 9 && context .date .Month == 8 && context .mode == CalendarMode .Month )
143+ {
144+ <TTag Theme =" Theme.Primary" >立秋</TTag >
145+ }
146+ @if ( context .date .Month == 8 && context .mode == CalendarMode .Year )
147+ {
148+ <TTag Theme =" Theme.Danger" >父亲的生日</TTag >
149+ }
150+ </CellContent >
151+ </TCalendar >
152+ </RunContent >
153+ <CodeContent >
154+ @Code.Create( @"
155+ ```cshtml-razor
156+ <TCalendar >
157+ <CellContent >
158+ @if ( context .date .Day == 9 && context .date .Month == 8 && context .mode == CalendarMode .Month )
159+ {
160+ <TTag Theme =" " Theme.Primary " " >立秋</TTag >
161+ }
162+ @if ( context .date .Month == 8 && context .mode == CalendarMode .Year )
163+ {
164+ <TTag Theme =" " Theme.Danger " " >父亲的生日</TTag >
165+ }
166+ </CellContent >
167+ </TCalendar >
16168```
17169")
18170 </CodeContent >
19171</Example >
20- </LayoutContent >
172+ </PageLayout >
0 commit comments