当前位置:网站首页>eventBus
eventBus
2022-04-23 02:52:00 【Diga】
1. In a component
introduce eventbus
import eventBus from ‘…/mlib/util/eventbus.js’;
beforeDestroy(){
var that = this;
eventBus.$emit('configItemKey', {
'configItemKey': that.configItemKeylist,
'type': that.type,
'scrollTop':this.scrollTop
});
},
2. Receive in another component
created() {
eventBus.$off('configItemKey'); Eliminate first to avoid duplicate acquisition
this.getEventBus();
}
getEventBus() {
var that = this;
eventBus.$on('configItemKey', function (data) {
that.$nextTick(() => {
that.channelItemKey = data.configItemKey;
})
})
}
3.eventBus Components :
import Vue from 'vue'
/** * Define empty vue example , As eventbus Realize the communication between non parent and child components (vue2.x Removed from broadcast) */
var eventBus = new Vue({
});
export default eventBus;
版权声明
本文为[Diga]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220717433922.html
边栏推荐
- MySQL complex query uses temporary table / with as (similar to table variable)
- ROP Emporium x86_64 7~8题
- 解决win7 中powershell挖矿占用CPU100%
- Solve the problem that the registered Google email Gmail mobile number cannot be used for verification
- JS using the parameters of art template
- L2-006 树的遍历(中后序确定二叉树&层序遍历)
- VirtualBox virtual machine (Oracle VM)
- The input of El input input box is invalid, and error in data(): "referenceerror: El is not defined“
- JSON data text
- 进阶上将程序员必备素质
猜你喜欢
Practical combat of industrial defect detection project (II) -- steel surface defect detection based on deep learning framework yolov5
Log cutting - build a remote log collection server
谷雨
Liunx foundation - zabbix5 0 monitoring system installation and deployment
windows MySQL8 zip安装
Efficient music format conversion tool Music Converter Pro
Intelligent agricultural management model
C language 171 Number of recent palindromes
Android high-level interview must ask: overall business and project architecture design and reconstruction
How can enterprises with major hazard installations ensure the completion of the digital construction task of double prevention mechanism by the end of the year
随机推荐
Specific field information of MySQL export table (detailed operation of Navicat client)
Windows MySQL 8 zip installation
If MySQL / SQL server judges that the table or temporary table exists, it will be deleted
MySQL复杂查询使用临时表/with as(类似表变量)
JZ35 复杂链表的复制
1215_ Hello world used by scons
国产轻量级看板式Scrum敏捷项目管理工具
Classification and regression tree of machine learning
Innovation and management based on Scrum
Those years can not do math problems, using pyhon only takes 1 minute?
Download the genuine origin Pro 2022 tutorial and how to activate it
Using go language to build web server
期中汇总(概论+应用层+运输层)
The input of El input input box is invalid, and error in data(): "referenceerror: El is not defined“
Winsock programming interface experiment: implementation of ipconfig
学习正则表达式选项、断言
Shell script learning -- practical case
Probabilistic model of machine learning
The problem of removing spaces from strings
Chapter VI project information management system summary