代码写在mounted里
关于,为社么,可以了解下vue的生命周期
式样
代码
mounted() {
this.getData(this.$store.state.user.deptId, this.$store.state.user.year)//取共通字段,请无视
this.timeTask = setInterval(this.timeTasks, 3600000)//定时任务,请无视
let that = this
window.addEventListener('resize', function () {
if (that.myBakeDayNumbe) {
that.myBakeDayNumbe.resize()
}
if (that.myBakeProcess) {
that.myBakeProcess.resize()
}
})
},
其他注意事项
- myBakeDayNumbe等必须要在data中声明
- 曲线图等,初始化代码,一定要这样写,才能初始化,如下图