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