getters.ts 681 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/**
 * 根据viewTag获取指定视图的视图数据变化状态
 * 
 * @param state 
 */
export const getStateByViewTag = (state: any) => (viewTag: string) => {
  const appView = state.appViews.find((appView: any) => Object.is(appView.viewTag, viewTag));
  if (appView) {
    return appView.viewDataChange;
  } else {
    return false;
  }
}

/**
* 根据路由路径path获取指定视图的视图数据变化状态
* 
* @param state 
*/
export const getStateByPath = (state: any) => (path: string) => {
  const appView = state.appViews.find((appView: any) => Object.is(appView.path, path));
  if (appView) {
    return appView.viewDataChange;
  } else {
    return false;
  }
}