The anion exchange membrane (AEM) is a main component for AEM fuel cells. Recently, a series of electrolytes based on covalent organic frameworks (COFs) functionalized with quaternary ammonium (QA) of showed extraordinary ionic conductivities thanks to the intrinsic porosity of the COF structures, which also provide a robust backbone for good mechanical strength. However, the chemical stability of the COF-based AEMs in alkaline conditions is yet to be understood. Here we systematically investigate the chemical degradation of the COF-based structures tethered with alkyl spacers by combining molecular dynamics (MD) simulations and density functional theory (DFT) calculations. We find that the water environment protects the cationic groups from chemical degradation in terms of both physical and chemical effects, which play a synergistic role. Moreover, we introduce the effective density of water as an order parameter to quantitatively characterize the level of degradation of the COF-based systems with similar design of architecture. The results provide guidance for estimation of the chemical stability of COF-based AEMs.