| 价值 | |
|---|---|
| 规则 ID | BL0002 | 
| 类别 | 用法 | 
| 修复是中断修复还是非中断修复 | 非中断 | 
原因
派生自ComponentBase的类型上有多个参数被CaptureUnmatchedValues = true注释。
规则说明
对于组件,只有一个参数应将 CaptureUnmatchedValues 设置为 true。
@code
{
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter1 { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter2 { get; set; }
}
如何修复违规行为
仅限单个参数设置 CaptureUnmatchedValues。
@code
{
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter1 { get; set; }
    [Parameter] public Dictionary<string, object> Parameter2 { get; set; }
}
何时禁止显示警告
不禁止显示此规则发出的警告。