12345678910111213141516171819202122232425 |
- <template>
- <div class="demo">
- 组件五:全局事件总线
- <button @click="getWeather">获取节气</button>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- aa: '夏至'
- }
- },
- methods:{
- getWeather() {
- this.$bus.$emit('part1',this.aa)
- }
- }
- }
- </script>
- <style>
- </style>
|