itAlvy opened a new issue #10838: vue中无法监听echarts事件
URL: https://github.com/apache/incubator-echarts/issues/10838
 
 
   ### Version
   3.8.5
   
   ### Steps to reproduce
   ```js
   <script>
   import echarts from 'echarts'
   import { debounce } from '@/utils'
   require('echarts/theme/macarons') // echarts theme
   export default {
     name: 'networkLine',
     data() {
       return {
         chart: null,
         echarts
       }
     },
     mounted() {
       this.initChart()
       this.chart.on('click', function(params) {
         console.log(params)
       })
       // this.__resizeHanlder = debounce(() => {
       //   if (this.chart) {
       //     this.chart.resize()
       //   }
       // }, 100)
       // window.addEventListener('resize', this.__resizeHanlder)
     },
     beforeDestroy() {
       if (!this.chart) {
         return
       }
       // window.removeEventListener('resize', this.__resizeHanlder)
       // this.chart.dispose()
       // this.chart = null
     },
     methods: {
       initChart() {
         // macarons vintage dark infographic shine roma
         var chart = 
this.echarts.init(document.querySelector('.outage-container'))
         
         const options
         chart.setOption(options)
         chart.on('click', function(params) {
           console.log(params)
         })
       }
     }
   }
   </script>
   ```
   
   ### What is expected?
   应该如何操作,vue的版本为**2.5.16**
   
   ### What is actually happening?
   将echarts实例挂载到 chart 变量中打印不到任何东西. 使用var创建变量则会报错
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   
![image](https://user-images.githubusercontent.com/34973898/60962641-4bb70c80-a341-11e9-9774-e9628e139c26.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to