commit | author | age | ||
bf6fbe | 1 | <template> |
L | 2 | <div> |
3 | <div>下次加:{{ num}}</div> | |
4 | ||
5 | <button @click="additionHandle">+加法器</button> | |
6 | </div> | |
7 | </template> | |
8 | ||
9 | <script> | |
10 | import { | |
11 | EventBus | |
12 | } from './EventBus.js' | |
13 | console.log(EventBus) | |
14 | export default { | |
15 | data() { | |
16 | return { | |
17 | num: 1 | |
18 | } | |
19 | }, | |
20 | methods: { | |
21 | additionHandle() { | |
22 | EventBus.$emit('addition', { | |
23 | num: this.num++ | |
24 | }) | |
25 | } | |
26 | } | |
27 | } | |
28 | </script> |