Covalent organic frameworks (COFs) are polymer networks with a precise structure and permanent porosity, making them an attractive platform for the detection of volatile analytes due to their chemical stability and accessible active sites. In this study, based on electron-rich N,N,N',N' -tetrakis(4-aminophenyl)-1,4-benzenediamine moiety, two 2D COFs with different topological structures and stacking models were designed by the strategy of spatial effect. The conductivity of the AB-stacked COF-NUST-20 was an order of magnitude higher than that of the AA-stacked COF-NUST-30. With the protonation of the imine bond, both COFs exhibited a strong, rapid, and reversible visible color change in response to corrosive HCl vapor. In addition, the AB-stacked COF-NUST-20, which facilitates both interlayer and intralayer charge transfer, shows better sensing performance. These findings demonstrate the usefulness of all-aromatic 2D COFs as real-time responsive chemosensors and provide insight into the design of sensing materials with high sensitivity.