From 51b729a9b1c74633816bd9db6d8025411bc6da34 Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 24 Jul 2023 15:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=95=B0=E6=8D=AE=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/Index.vue | 9 ++++++++- src/views/home/components/Count.vue | 15 ++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/views/home/Index.vue b/src/views/home/Index.vue index ff67183..34edc50 100644 --- a/src/views/home/Index.vue +++ b/src/views/home/Index.vue @@ -40,9 +40,16 @@ export default { } }, created () { + console.log('created....') this.getInfo() + // 监听是否切换了日,周,月,年 + this.eventBus.$on('updateHomeDataByType', (type) => { + console.log(type) + this.getInfo() + }) }, - mounted () { + destroyed () { + this.eventBus.$off('updateHomeDataByType') }, methods: { getInfo () { diff --git a/src/views/home/components/Count.vue b/src/views/home/components/Count.vue index 475f10b..d38d0b4 100644 --- a/src/views/home/components/Count.vue +++ b/src/views/home/components/Count.vue @@ -104,19 +104,19 @@ - + - + - + - + - + @@ -228,15 +228,12 @@ export default { { key: 'year', title: '本年' } ] }), - beforeCreate () { - console.log('beforeCreate.......') - }, methods: { handleMenuClick (e) { this.typeIndex = this.searchs.findIndex(item => item.key === e.key) - console.log(e.key) this.visible = false this.type = e.key + this.eventBus.$emit('updateHomeDataByType', { type: e.key }) } } }