提交 a24688a8 编写于 作者: KK's avatar KK

zk——应用级数据状态同步(列表部件)

上级 bba446e7
...@@ -197,6 +197,15 @@ ...@@ -197,6 +197,15 @@
*/ */
public selections: Array<any> = []; public selections: Array<any> = [];
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public appStateEvent: Subscription | undefined;
/** /**
* Vue声明周期,组件挂载完毕 * Vue声明周期,组件挂载完毕
* *
...@@ -218,7 +227,6 @@ ...@@ -218,7 +227,6 @@
} }
}) })
} }
/** /**
* Vue声明周期,组件创建完毕 * Vue声明周期,组件创建完毕
...@@ -245,6 +253,16 @@ ...@@ -245,6 +253,16 @@
} }
}); });
} }
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"${ctrl.getPSAppDataEntity().getCodeName()}")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
} }
/** /**
...@@ -265,6 +283,9 @@ ...@@ -265,6 +283,9 @@
if (this.viewStateEvent) { if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe(); this.viewStateEvent.unsubscribe();
} }
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
<#if destroyed_block??> <#if destroyed_block??>
${destroyed_block} ${destroyed_block}
</#if> </#if>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册