The invention provides an electrochromic copolymer containing dioxythiophene and a 9, 9 '-spirobifluorene structure, the molecular formula of the electrochromic copolymer comprises the following structure: A represents sulfur or oxygen, and m and n both represent the degree of polymerization and are integers between 8 and 100. The preparation method comprises the following steps: (1) adding 3, 4-dioxo-1, 3, 4-thiadiazole and The preparation method comprises the following steps: adding 2, 2 ', 7, 7'-tetrabromo-9, 9 '-spirobifluorene, 3, 4-dibromo ethylene dioxythiophene or 3, 4-dibromo ethylene dithio thiophene, N, N-dimethylacetamide, potassium carbonate, palladium acetate and pivalic acid into a single-mouth flask, carrying out air suction and exchange on the single-mouth flask by using nitrogen or argon, keeping an air exchange atmosphere, sequentially heating and reacting the mixture, cooling to room temperature, dropwise adding into methanol, and carrying out a reaction under the protection of nitrogen or argon so as to obtain a target product, namely the 2, 2', 7, 7 '-tetrabromo-9, 9'-spirobifluorene. Filtering and collecting orange red precipitates; and 2) placing the orange red precipitate in a fat extractor, sequentially dissolving and washing with methanol, n-hexane and chloroform, concentrating a chloroform washing solution, finally dropwise adding into methanol, filtering and collecting the precipitate, thereby obtaining the target product.