blockly > 工作區 > renameVariableById
Workspace.renameVariableById() 方法
v12:使用 Blockly.Workspace.getVariableMap().renameVariable
如要重新命名變數,請在變數對應表中更新名稱。使用指定的 ID 找出要重新命名的變數。
Signature:
renameVariableById(id: string, newName: string): void;
參數
| 參數 | 類型 | 說明 |
|---|---|---|
| id | 字串 | 要重新命名的變數 ID。 |
| newName | 字串 | 新的變數名稱。 |
退貨:
void