当前位置:网站首页>什么是消息订阅和发布?
什么是消息订阅和发布?
2022-07-26 07:27:00 【刘家奕_】
目录
(1)介绍
话不多少,上图

下面给出一个例子的主要代码:
(2)消息订阅
子组件1
mounted() {
this.pubId = pubsub.subscribe("haha", function (msgName, data) {
console.log("有人发步了haha消息,回调函数被执行了", msgName, data);
});
},
beforeDestroy() {
pubsub.unsubscribe(this.pubId);
},
(3)消息发布
子组件2
methods: {
sendStudentName() {
// this.getStudentName(this.studentName);
pubsub.publish("haha", this.studentName);
},
},边栏推荐
猜你喜欢

QT: list box, table, tree control

Redis系列之什么是布隆过滤器?

4. Data integrity

Configure flask

NFT数字藏品开发:数字藏品与NFT的六大区别

Compose text and icon splicing to realize drawableleft or drawableright

Apache dolphin scheduler & tidb joint meetup | focus on application development capabilities under the development of open source ecosystem

4、数据的完整性

In July, glassnode data showed that the open position of eth perpetual futures contract on deribit had just reached a one month high of $237959827.

Installation of Baidu flying paste deep learning framework tutorial in Anaconda
随机推荐
Compose canvas custom circular progress bar
pycharm常用快捷键
Apache Dolphinscheduler3.0.0-beta-1 版本发布,新增FlinkSQL、Zeppelin任务类型
NFT digital collection system development: digital collections give new vitality to brands
Hcip--- BGP comprehensive experiment
6. Backup and recovery of MySQL database
倒计时2日!基于 Apache DolphinScheduler&TiDB 的交叉开发实践,从编写到调度让你大幅提升效率
如何保证缓存和数据库的双写一致性?
mysql语法(二)(纯语法)
数据平台调度升级改造 | 从Azkaban 平滑过度到 Apache DolphinScheduler 的操作实践
程序环境和预处理
DevExpress.XtraEditors.DataNavigator用法
:app:checkDebugAarMetadata 2 issues were found when checking AAR metadata: 2 issues were found when
MySQL installation tutorial - hands on installation
How can man Bang write a new footnote to the value of the industry's first social responsibility report?
In July, glassnode data showed that the open position of eth perpetual futures contract on deribit had just reached a one month high of $237959827.
6. Combined data type
Taishan Office Technology Lecture: how to calculate page blank (margin)
C语言关键字extern
记一次路由器频繁掉线问题的分析、解决与发展