ngrx心得體會總結
乙個典型的場景:新增店鋪商品,其中店鋪有多個,每個店鋪有不同的商品分類,商品分類可以多級!
@injectable()
export
// 新增店鋪商品
@effect()
startaddshopgoods$ = this.oftype(actiontypes.startaddshopgoods).pipe(
takeuntil(this.oftype(actiontypes.error).pipe(
tap(res =>
console.log('發生了點錯誤'))
)),switchmap(res => );
// 新增選擇店鋪
return
this.oftype(actiontypes.selectshop).pipe(
switchmap(res => );
// 選擇店鋪商品分類
return
this.oftype(actiontypes.selectshopgoodscateogry).pipe(
tap(res => );
}),switchmap(res => ).pipe(
map(res => );
return
new addsuccessshopgoods();
})))
);})
);})
);})
);// 公共載入
@effect()
searchshop$ = this.oftype(actiontypes.searchshop).pipe(
switchmap(res => ).pipe(
pluck('data'),
pluck('list')
);}),
map(res => )
);@effect()
searchshopgoodscategory$ = this.oftype(actiontypes.searchshopgoodscategory).pipe(
switchmap(res => ).pipe(
pluck('data'),
pluck('list')
);}),
map(res => )
);constructor(private actions$: actions,
private store: store,
private util: iwe7util2service,
private router: router
) oftypeextends action>(name: string): actions
}複製**
總結: actions 定義操作 effects 串聯actions,完成業務邏輯 reducers 操作store model 定義結構 程式設計心得體會總結
1.需求變更時,從根本上解決問題與採用取巧的方式規避問題相比,短期來看,也許需要花費更多時間與精力。但從長期講,取巧的方式難於適應變化,需求的稍微變動可能就需要花費更多的精力,以及犧牲 的可讀性。2.方法的名字應該精確的表達方法所做的事情,它應該是方法最好的注釋。方法應盡量簡單,不應負責過多的事情,...
專案總結心得體會
隨著各個專案實施的展開,專案各多多少少都出現了一些問題,或者是發生了事故,或者指揮和管理出現一些混亂,影響了工作目標,留下了隱患。及時總結這些經驗教訓是非常必要的,下面從專案管理角度對出現的問題和事故進行分析和總結。1 對專案經理的現場指揮 關於對專案經理的指揮,現在感覺有些混亂。專案經理在公司時還...
PHP PDO 心得體會
關於pdo 我想可以不用做過多的描述,寫一寫最近的使用心得體會 首先 關於如何使用pdo 連線到資料庫 dbms mysql 使用的資料庫 host localhost 選擇的主機 dbname test 選擇的資料庫 user root 登陸的使用者名稱 password 使用者密碼 dsn dm...