Tag Archives: Initialization of Baidu map in Vue

Error in created hook: “typeerror: cannot read property ‘cm’ of undefined”

At the beginning, I put the initialization and instance of the map in the created hook function. As a result, I reported an error

Error in created hook: “TypeError: Cannot read property ‘CM’ of undefined”

When ecarts was used before, it would report an error when it was put in created at the beginning. Later, it was put in mounted after Baidu, so it was directly put in mounted, and the effect was realized.

Learn the difference between these two hook functions and make a record to deepen your impression