feat: 引入 tiny-emitter 插件

This commit is contained in:
@changcode
2022-01-19 16:18:11 +08:00
parent da28c3d940
commit 53202d7b0c
3 changed files with 10 additions and 0 deletions

View File

@@ -45,6 +45,10 @@ export default {
}
},
mounted () {
const _this = this
this.emitter.on('chart-pageNo', function () {
_this.resetPageNo()
})
this.$el.querySelector('.el-pagination__jump').childNodes[0].nodeValue = ''
}
}

View File

@@ -13,6 +13,8 @@ import 'highlight.js/styles/color-brewer.css'
import '@/assets/css/main.scss' // 样式入口
import VueGridLayout from 'vue-grid-layout'
import ElementPlus from 'element-plus'
import bus from 'tiny-emitter'
const emitter = new bus()
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc' // dependent on utc plugin
import timezone from 'dayjs/plugin/timezone'
@@ -54,4 +56,6 @@ app.component('time-refresh', TimeRefresh)
app.component('panel-chart-list', PanelChartList)
app.mount('#app')
app.config.globalProperties.emitter = emitter
export default app

View File

@@ -232,6 +232,7 @@ export default {
this.standaloneTimeRange.use = true
this.standaloneTimeRange.startTime = myStartTime
this.standaloneTimeRange.endTime = myEndTime
this.emitter.emit('chart-pageNo')
this.getChartData(null, {}, true)
},
showFullscreen (show) {
@@ -288,6 +289,7 @@ export default {
this.loading = show
},
tableChange () {
this.emitter.emit('chart-pageNo')
this.getChartData()
},
getTargetPageData (pageNum, pageSize, tableData) {