angular - 如何为以下日期类型定义接口
问题描述
我正在尝试为 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[]
}
希望有用
推荐阅读
- python - 在 PyQt 应用程序中嵌入 aiohttp 服务器
- java - 获取 SQLException:ResultSet 关闭后不允许操作
- c++ - 无法从字符串转换为模板 C2664
- facebook - 无法在开发中测试 Facebook OAuth,因为“有效 OAuth 重定向 URI”不允许 localhost
- python - 仅当标题栏未在 QDockWidget 中浮动时如何删除它
- postgresql - Hassura 容器未连接到在 localhost 上运行的 postgres
- javascript - 在计算最大值和最小值Javascript时得到错误的值
- mysql - 使用 Group By MySQL 连接 3 个表
- go - 去测试验证 connect2id 给出“invalid_client”错误
- android - android中自动完成文本视图内的动态表格布局