如何为以下日期类型定义接口
how to define interface for the following date type
我正在尝试为 this.usedPercentageFilterOptions 定义接口类型。你知道下面的接口声明是否正确吗?
`
interface Item {
filterPillValue: string,
id: string,
label: string
}
interface Items {
radio: Item,
checkbox: Item
}
public usedPercentageFilterOptions: Items[]
this.usedPercentageFilterOptions = [
{
radio: { filterPillValue: 'used%', id:'filter-used-%', label: 'Used %' },
checkbox: [
{ filterPillValue: 'Full', id:'filter-full', label: 'Full' },
{ filterPillValue: 'Reached Critical threshold', id:'filter-critical-threshold', label: 'Reached Critical threshold' },
{ filterPillValue: 'Reached Warning threshold', id:'filter-warning-threshold', label: 'Reached Warning threshold' },
{ filterPillValue: 'Not reached threshold', id:'filter-not-reached-threshold', label: 'Not reached threshold' }
]
}
];`
试试这个
export interface Cb {
filterPillValue?: string;
id?: string;
label?: string
}
和
export interface UsedPer {
radio?: Cb;
checkbox?: Cb[]
}
希望有用
我正在尝试为 this.usedPercentageFilterOptions 定义接口类型。你知道下面的接口声明是否正确吗?
`
interface Item {
filterPillValue: string,
id: string,
label: string
}
interface Items {
radio: Item,
checkbox: Item
}
public usedPercentageFilterOptions: Items[]
this.usedPercentageFilterOptions = [
{
radio: { filterPillValue: 'used%', id:'filter-used-%', label: 'Used %' },
checkbox: [
{ filterPillValue: 'Full', id:'filter-full', label: 'Full' },
{ filterPillValue: 'Reached Critical threshold', id:'filter-critical-threshold', label: 'Reached Critical threshold' },
{ filterPillValue: 'Reached Warning threshold', id:'filter-warning-threshold', label: 'Reached Warning threshold' },
{ filterPillValue: 'Not reached threshold', id:'filter-not-reached-threshold', label: 'Not reached threshold' }
]
}
];`
试试这个
export interface Cb {
filterPillValue?: string;
id?: string;
label?: string
}
和
export interface UsedPer {
radio?: Cb;
checkbox?: Cb[]
}
希望有用