# 抛出的事件 ★
通过 postMessage 在某些时机抛出事件。通过 iframe
嵌入的页面可以监听自己感兴趣的事件。
# 使用说明
登陆成功
事件名:HOSLogged
。登陆成功后会抛出该事件。window.postMessage({ type: "HOSLogged", value: true }, "*");
Tab 切换
事件名:afterTabSwitch
。Tab 切换后会抛出该事件。window.postMessage( { type: "afterTabSwitch", data: { to: key, from: old } }, "*" );
切换页签确认
事件名:isNeedSwitch
。Tab 切换前抛出该事件,如果返回 false 则不切换,返回 true 则切换。window.postMessage({ type: "isNeedSwitch", data: newTab }, "*");
删除页签确认
事件名:isNeedRemove
。Tab 删除前抛出该事件,如果返回 false 则不删除,返回 true 则删除。window.postMessage({ type: "isNeedRemove", data: key }, "*");
退出确认
事件名:isNeedLogout
。退出登陆前抛出该事件,如果返回 false 则不退出,返回 true 则退出。window.postMessage({ type: "isNeedLogout", data: "login" }, "*");
用户信息
事件名:
login-show-user-info
。登陆用户信息发生变化时抛出该事件。window.postMessage( { type: "login-show-user-info", value: { loginName: this.loginAccountId.loginName, accountId: this.loginAccountId.accountId, personId: this.personId, postId: post.postId, buId: post.buId, }, divId: "login-user-info-wrap", }, "*" );
打印
事件名:
sendHtml
。可以监听该事件获取到打印渲染时的 html。win.postMessage( { funType: "sendHtml", data: msgData, params: data.params, eventData: data, winId, }, "*" );