@page "/counter" <PageTitle>Counter</PageTitle> <SubComponnent test="returnDatas"></SubComponnent> <h1>Counter</h1> <p role="status">Current count: @currentCount</p> <button class="btn btn-primary" @onclick="IncrementCount">Click me</button> @code { private int currentCount = 0; private void IncrementCount() { currentCount++; } private void returnDatas(string test){ var x = test; } }
<h3>SubComponnent</h3> <button @onclick="aaaa">test</button> @code { [Parameter] public EventCallback<string> test { get; set; } private async void aaaa() { await test.InvokeAsync("hahahaha"); } }
标签:currentCount,void,private,传递数据,test,组件,Blazor From: https://www.cnblogs.com/stonechina/p/17100903.html