Simultaneously improving charge carrier separation and surface reaction efficiency is crucial for enhancing the photocatalytic H2O2 production efficiency of covalent organic frameworks (COFs). Here, a heteroatom-lock strategy is introduced into the acceptor structure of COFs, w...