A preparation method based on simultaneous package of a target substance and synthesis of MOFs with redox activity, wherein methylene blue is selected as an organic target molecule, the methylene blue is packaged in the MOFs when the MOFs are synthesized by using a one-pot method to obtain ZIF-8 modified by the methylene blue. The drawback that above-mentioned MOFs material does not have electrical conductivity is overcome, the method is simple, rapid and low in cost, and the prepared product can accurately, sensitively, simply and quickly detect dopamine, and a new development direction is provided for researches in the fields of biological detection and chemical analysis, etc.