问题描述
我有两个组件。IPB 是父组件,IPB_BrakeDurability 是子组件。
我想在值改变时改变子组件的 inputClass,我该如何使用 valuechanged 事件??非常感谢。以下是两个组件。
IPB.razor(使用 IPB_BrakeDurability 组件。)
<IPB_BrakeDurability IPBTI_BrakeDurability="@IPBTI.IPBTI_BrakeDurability" />
@code {
IPBTI IPBTI;
double[] deceleration = { 0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00,1.05,1.10,1.15,1.20,1.25,1.30 };
double[] frequencyMotion = { 205033,639927,404300,200177,84266,35147,14463,7168,3893,2144,1252,745,466,332,198,91,77,63,52,41,32,25,19,14,10,65 };
double[] frequencyStandstill = { 84569,243706,115070,56182,25350,16912,12771,9810,7793,5892,4585,3474,2718,2218,1613,1067,995,917,831,739,640,534,421,301,175,717 };
protected override void OnInitialized()
{
base.OnInitialized();
IPBTI = new IPBTI();
IPBTI.IPBTI_BrakeDurability = new IPBTI_BrakeDurability { Deceleration = deceleration,FrequencyMotion = frequencyMotion,FrequencyStandstill = frequencyStandstill };
}
}
IPB_BrakeDurability.razor
<MatTextField Value="@IPBTI_BrakeDurability.FrequencyMotion[0]" TValue="double" ValueChanged="@(()=>SetInputClass())" InputClass="@inputClass" />
<style>
.text-field-class {
font-family: monospace;
color: red !important;
}
</style>
@code {
[Parameter]
public IPBTI_BrakeDurability IPBTI_BrakeDurability { get; set; }
string inputClass=string.Empty;
private string SetInputClass()
{
inputClass = "text-field-class";
return inputClass;
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)