Home > LIB_Device > searchByProperties
LIB_Device.searchByProperties() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
使用属性精确搜索器件
签名
typescript
function searchByProperties(
properties: ILIB_DevicePropertiesForSearch,
libraryUuid?: string,
classification?: Array<string>,
symbolType?: ELIB_SymbolType,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_DeviceSearchItem>>;1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
参数名
参数 | 类型 | 描述 |
|---|---|---|
properties | 属性 | |
libraryUuid | string | (可选) 库 UUID,默认为系统库,可以使用 LIB_LibrariesList 内的接口获取 |
classification | Array<string> | (可选) 分类,默认为全部 ADD since EDA v4 |
symbolType | (可选) 符号类型,默认为全部 | |
itemsOfPage | number | (可选) 一页搜索结果的数量 |
page | number | (可选) 页数 |
返回值
Promise<Array<ILIB_DeviceSearchItem>>
搜索到的器件属性的列表
示例
javascript
// 1. 按立创 C 编号精确搜索,每页 5 条
const results = await eda.lib_Device.searchByProperties(
{ supplierId: 'C1523' },
undefined,
undefined,
undefined,
5,
1
);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'supplierId:', item.supplierId);
});1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15