inleft
2022-08-30 afab3a98a65f7fb4f342251238ab3c329e4242dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// showNum.vue 中接收事件
 
<template>
    <div>计算和: {{count}}</div>
</template>
 
<script>
    import {EventBus} from './EventBus.js'
    export default {
        data() {
            return {
                count: 0
            }
        },
 
        mounted() {
            EventBus.$on('addition', param => {
                this.count = this.count + param.num;
            })
        }
    }
</script>