事件外面定义
let that = this
事件里面定义使用that即可解决
示例
let that = this
this.yxsjLeftChart.on('click', function(param) {
that.$layer.open({
type: 2,
title: '看板',
shadeClose: false,
shade: 0.5,
area: ['1720px', '880px'],
scrollbar: false,
content: {
content: jzgyGC, //传递的组件对象
data:{}//props
},
})
})
如果没有在点击事件外层定义this,function里面this会是undefined