From 2ebf05b70faa99d1560e59e4b6e4e3bafcbd41ce Mon Sep 17 00:00:00 2001 From: xiaosi <2652281683@qq.com> Date: Mon, 27 Nov 2023 17:09:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E9=9B=86=E6=88=90=E3=80=91mitt?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=80=BB=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 1 + package.json | 1 + src/utils/eventBus.js | 6 ++++++ 3 files changed, 8 insertions(+) create mode 100644 src/utils/eventBus.js diff --git a/package-lock.json b/package-lock.json index 0d4e8de..18c5e2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "axios": "^1.6.2", "jwt-decode": "^4.0.0", "less": "^4.2.0", + "mitt": "^3.0.1", "pinia": "^2.1.7", "tdesign-vue-next": "^1.7.0", "vue": "^3.3.4", diff --git a/package.json b/package.json index 8f4a7a9..e08f76c 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "axios": "^1.6.2", "jwt-decode": "^4.0.0", "less": "^4.2.0", + "mitt": "^3.0.1", "pinia": "^2.1.7", "tdesign-vue-next": "^1.7.0", "vue": "^3.3.4", diff --git a/src/utils/eventBus.js b/src/utils/eventBus.js new file mode 100644 index 0000000..a11145c --- /dev/null +++ b/src/utils/eventBus.js @@ -0,0 +1,6 @@ +/** + * 事件总线(用于跨组件通信,一般用于非父子组件) + */ +import mitt from 'mitt'; + +export default mitt();