File tree 5 files changed +59
-5
lines changed
5 files changed +59
-5
lines changed Original file line number Diff line number Diff line change 1
1
div {
2
2
display : inline-block;
3
- border : 2px solid black ;
4
- background : # eee ;
3
+ border : 2px solid # 55328c ;
4
+ background : # f0eaf7 ;
5
5
padding : 1em ;
6
6
margin : 1em ;
7
+ background-image : url ("assets/blazor-icon.png" );
8
+ background-repeat : no-repeat;
7
9
}
Original file line number Diff line number Diff line change
1
+ <div class =" container" >
2
+ <div ><span >id: </span >@Hero.id </div >
3
+ <div >
4
+ <label for =" hero-name" >Hero name: </label >
5
+ <input id =" hero-name" @bind =" newName" placeholder =" Hero name" @bind:event =" oninput" @onkeyup =" UpdateHero" />
6
+ </div >
7
+ </div >
8
+
9
+ @code {
10
+
11
+ [Parameter ]
12
+ public Hero Hero { get ; set ; } = new (0 , " " );
13
+
14
+ [Parameter ]
15
+ public EventCallback <Hero > HeroChanged { get ; set ; }
16
+
17
+ private string newName = " " ;
18
+
19
+
20
+ protected override void OnParametersSet () {
21
+ newName = Hero .name ;
22
+ }
23
+
24
+ private async Task UpdateHero () {
25
+ Hero = Hero with { name = newName };
26
+ await HeroChanged .InvokeAsync (Hero );
27
+ }
28
+
29
+ }
Original file line number Diff line number Diff line change
1
+ div .container {
2
+ display : inline-block;
3
+ border : 2px solid # 55328c ;
4
+ background : # f0eaf7 ;
5
+ padding : 30px ;
6
+ margin : 1em ;
7
+ background-image : url ("assets/blazor-icon.png" );
8
+ background-repeat : no-repeat;
9
+ }
Original file line number Diff line number Diff line change 2
2
3
3
<h1 >Blazor Components Test Project</h1 >
4
4
5
- <Counter />
6
- <Counter />
7
- <Counter />
5
+ <div >
6
+ <Counter />
7
+ <Counter />
8
+ <Counter />
9
+ </div >
10
+
11
+ <HeroEditor Hero =" @testHero" HeroChanged =" OnHeroChanged" />
12
+
13
+ @code {
14
+ private Hero testHero = new (5 , " Arnold" );
15
+
16
+ private void OnHeroChanged (Hero hero ) {
17
+ testHero = hero ;
18
+ Console .WriteLine (" Hero changed: " + hero );
19
+ }
20
+
21
+ }
You can’t perform that action at this time.
0 commit comments