Home > LIB_Symbol > searchByProperties
LIB_Symbol.searchByProperties() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
使用属性精确搜索符号
签名
typescript
function searchByProperties(
properties: ILIB_SymbolPropertiesForSearch,
libraryUuid?: string,
): Promise<Array<ILIB_SymbolSearchItem>>;1
2
3
4
2
3
4
参数名
参数 | 类型 | 描述 |
|---|---|---|
properties | 属性 | |
libraryUuid | string | (可选) 库 UUID,默认为系统库,可以使用 LIB_LibrariesList 内的接口获取 |
返回值
Promise<Array<ILIB_SymbolSearchItem>>
搜索到的符号属性的列表
示例
javascript
// 1. 按名称精确搜索(官方属性集合目前仅支持 name)
// 当前版本该接口不稳定:可能抛错,也可能正常返回 undefined,两种都要兼容
let results;
try {
results = await eda.lib_Symbol.searchByProperties({ name: '0402' });
}
catch (e) {
console.log('当前版本按 name 搜索抛错:', e.message);
}
if (!Array.isArray(results))
results = [];
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'libraryUuid:', item.libraryUuid);
});1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17