The present invention relates to a heterocyclic compound, a pharmaceutical composition containing the same, a preparation method thereof, and use thereof as a fibroblast growth factor receptor (FGFR) inhibitor. The compound is a heterocyclic compound as shown in Formula I, or a pharmaceutically acceptable salt, prodrug, solvent compound, polymorph, isomer or stable isotopic derivative thereof. The present invention further relates to use of the compound for the treatment or prevention of related diseases which are FGFR-mediated such as cancer, and a method for applying the compound to treat said diseases.