[Solved] Vue Import echarts error: Error in mounted hook: “TypeError: Cannot read property ‘init’ of undefined”

background

After the introduction of echarts, an error is reported when calling
[Vue warn]: Error in mounted hook: “TypeError: Cannot read property’init’ of undefined”

reason

Wrong way of introduction

import echarts from 'echarts'

Solution

change the import method
let echarts = require('echarts')

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *