Home > LIB_Device > getByLcscIds
LIB_Device.getByLcscIds() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
使用立创 C 编号批量获取器件
签名
typescript
function getByLcscIds(
lcscIds: Array<string>,
libraryUuid?: string,
allowMultiMatch?: boolean,
): Promise<Array<ILIB_DeviceSearchItem>>;1
2
3
4
5
2
3
4
5
参数名
参数 | 类型 | 描述 |
|---|---|---|
lcscIds | Array<string> | 立创 C 编号数组 |
libraryUuid | string | (可选) 库 UUID,默认为系统库,可以使用 LIB_LibrariesList 内的接口获取 |
allowMultiMatch | boolean | (可选) 是否允许单个立创 C 编号匹配多个结果 |
返回值
Promise<Array<ILIB_DeviceSearchItem>>
搜索到的器件属性的列表
备注
默认情况下,如果在同一个库内匹配到多个相同 C 编号的器件,将只会返回第一个结果;
如果希望返回多个结果,请将 allowMultiMatch 置为 true;
私有化部署环境暂无法使用本接口
示例
javascript
// 1. 单个 C 编号查询(默认搜索系统库)
const one = await eda.lib_Device.getByLcscIds('C1523');
console.log('single count:', one.length);
console.log('[0] uuid:', one[0].uuid, 'supplierId:', one[0].supplierId);
// 2. 批量查询多个 C 编号
const many = await eda.lib_Device.getByLcscIds(['C1523', 'C17168']);
console.log('batch count:', many.length);
many.forEach((item, i) => {
console.log(`[${i}] uuid:`, item.uuid, 'supplierId:', item.supplierId);
});1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11