Home > SYS_ToastMessage > showMessage
SYS_ToastMessage.showMessage() method
Warning: This API is now obsolete.
Please use the SYS_Message.showToastMessage() method instead
Show a toast message
Signature
typescript
function showMessage(
message: string,
messageType?: ESYS_ToastMessageType,
timer?: number,
bottomPanel?: ESYS_BottomPanelTab,
buttonTitle?: string,
buttonCallbackFn?: string,
): void;1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Parameters
Parameter | Type | Description |
|---|---|---|
message | string | Message content |
messageType | (Optional) Message type | |
timer | number | (Optional) Auto-close countdown in seconds. |
bottomPanel | (Optional) Expand the bottom information panel | |
buttonTitle | string | (Optional) Callback button title |
buttonCallbackFn | string | (Optional) Callback function content, in string form. It will be automatically parsed and executed |
Returns
void
Example
javascript
// 1. 最简调用:默认信息类型,倒计时结束后自动消失
eda.sys_ToastMessage.showMessage('嘉立创示例 工程已自动保存');
console.log('信息吐司已显示');
// 2. 指定消息类型与倒计时秒数:成功图标,2 秒后自动关闭
eda.sys_ToastMessage.showMessage('嘉立创示例 导出完成', 'success', 2);
console.log('成功吐司已显示,2 秒后自动关闭');
// 3. 带回调按钮与底部面板联动:点击按钮执行回调并展开日志面板
eda.sys_ToastMessage.showMessage(
'嘉立创示例 检查完成,详见日志面板',
'warn',
5,
'log',
'查看日志',
'console.log("嘉立创示例 按钮回调被执行")'
);
console.log('警告吐司已显示,附带查看日志按钮,5 秒后自动关闭');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