DMT_Panel.copyPanel() method
复制面板
签名
typescript
function copyPanel(panelUuid: string): Promise<string | undefined>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
panelUuid | string | 源面板 UUID |
返回值
Promise<string | undefined>
新面板 UUID,如若为 undefined 则复制失败
示例
javascript
// 1. 创建一个专用源面板并等 1.5s 同步(复制前源面板必须已在工作区落地)
const sourceUuid = await eda.dmt_Panel.createPanel();
await new Promise(r => setTimeout(r, 1500));
// 2. 复制源面板,返回副本 UUID
const copiedUuid = await eda.dmt_Panel.copyPanel(sourceUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 回读副本,确认名称与所属工程
const copyInfo = await eda.dmt_Panel.getPanelInfo(copiedUuid);
console.log('copiedUuid:', copiedUuid);
console.log('copyName:', copyInfo?.name);
// 4. 清理本例创建的两个面板(先删副本再删源),保持工程整洁
const deletedCopy = await eda.dmt_Panel.deletePanel(copiedUuid);
console.log('deleted:', deletedCopy);
const deletedSource = await eda.dmt_Panel.deletePanel(sourceUuid);
console.log('deleted:', deletedSource);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18