Herein, a vinylene-linked covalent organic framework (TMT-BPDA-COF) was prepared via the Aldol condensation of 2,4,6-trimethyl-1,3,5-triazine (TMT) and 4,4'-biphenyl dimethyl formaldehyde (BPDA). TMT-BPDA-COF displayed high crystallinity and thermal stability, and robust chemical stability in strong acid, strong base and common organic solvents. TMT-BPDA-COF nanosheets emitted strong yellow fluorescence with the quantum yield of 14.9% and showed fast reversible response toward pH with a wide range (pH 0.0 ∼ 14.0) based on the intramolecular charge transfer effect. Furthermore, portable fluorescent sensors were prepared by incorporated TMT-BPDA-COF nanosheets into agarose gel and cellulose acetate butyrate (CAB), respectively. TMT-BPDA-COF gel showed a wide pH response range over pH 0.0 ∼ 14.0 with a linear range of pH 4.0 ∼ 14.0. TMT-BPDA-COF CAB film exhibited high sensitivity for sensing of NH3 gas with a limit of detection of 1.6 ppb. TMT-BPDA-COF agarose gel and CAB film also exhibited good reversibility and reproducibility in response to pH and NH3 gas, respectively. We expect TMT-BPDA-COF-based sensors, which feature fast response, high sensitivity, wide response range, good reproducibility and reversibility, can apply to detect pH and NH3 gas in the field of environment and industry.