A covalent organic framework and a method of preparing the same are disclosed. The covalent organic framework is used to produce an electrode material and includes a repeating unit represented by the following chemical formula: In the formula, A1, A2, and A3 are the same or different, and are independently a monocyclic or polycyclic aromatic ring, and R1 and R2 are the same or different, and are independently selected from hydrogen, a functional group containing at least one nitrogen, phosphorus, or sulfur, an unsubstituted or substituted C1-C6 alkyl group, an unsubstituted or substituted C2-C6 alkenyl group, an unsubstituted or substituted C2-C6 alkynyl group, and an unsubstituted or substituted C1-C6 alkoxy group.