首先实例化:
bus.js
import Vue from 'Vue' export default new Vue()
组件1,
import bus from '../../assets/js/bus.js' fun(myDate){
bus.$emit('G_ievent',myDate);
}
组件2,
mounted(){ //两种接收的方式 bus.$on('G_ievent',(date) =>{ //this.timelist(date) }) },
首先实例化:
bus.js
import Vue from 'Vue' export default new Vue()
组件1,
import bus from '../../assets/js/bus.js' fun(myDate){
bus.$emit('G_ievent',myDate);
}
组件2,
mounted(){ //两种接收的方式 bus.$on('G_ievent',(date) =>{ //this.timelist(date) }) },