I created 3 components which have the exact same implementation with only 1 difference:
- The 1st component (MyTest) is implemented in the same project as its parent component
- The 2nd one (Component1) is from a different (but same solution)
- The 3rd (CSInput) is imported from a NuGet package. Below are the invokation of all 3 in the same parent.
The razor component implementation is as followed:
<input disabled="@Disabled">
@code {
[Parameter]
public bool Disabled { get; set; }
}
The snippet of the parent implementation:
// The Disabled property is coded as boolean
<MyTest Disabled="@DisableMyTest"/>
<RazorClassLibrary1.Component1 Disabled="@DisableMyTest" />
<CSInput Disabled="@DisableMyTest"/>
@code{
private bool DisableMyTest = false;
}
For an unknown reason, the compiler issued a CS1503 (cannot convert from 'bool' to 'string') on the Disabled property from CSInput. Any idea why? Many Thanks!
question from:
https://stackoverflow.com/questions/65838164/custom-razor-component-a-nuget-library-behaves-differently 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…