From b7389c76d243550d6e141fbe6d787709f72be1b1 Mon Sep 17 00:00:00 2001 From: novlan1 <1576271227@qq.com> Date: Sat, 6 Jan 2024 15:55:37 +0800 Subject: [PATCH] feat(ebus): add ebus --- docs/CHANGELOG.md | 42 +++++++++++----------------------- docs/zh/e-bus.md | 43 +++++++++++++++++++++++++++++++++++ docs/zh/mixin.md | 20 ++++++++++++++-- package.json | 2 +- src/change-log/change-log.ts | 2 +- src/e-bus/e-bus.ts | 34 +++++++++++++++++++++++++++ src/e-bus/index.ts | 2 ++ src/e-bus/init.ts | 34 +++++++++++++++++++++++++++ src/index.ts | 1 + src/mixin/index.ts | 1 + src/mixin/msdk-full-screen.ts | 22 ++++++++++++++++++ 11 files changed, 170 insertions(+), 33 deletions(-) create mode 100644 docs/zh/e-bus.md create mode 100644 src/e-bus/e-bus.ts create mode 100644 src/e-bus/index.ts create mode 100644 src/e-bus/init.ts create mode 100644 src/mixin/msdk-full-screen.ts diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 263d36c5..462efc16 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,51 +1,35 @@ # 更新日志 +### [1.3.48](https://github.com/novlan1/t-comm/compare/v1.3.47...v1.3.48) (2024-01-04) +### Features 🎉 +* **e-bus:** add ebus ([487b969](https://github.com/novlan1/t-comm/commit/487b96901973f11b58fc38d7ae0cf65bda82b5bf)) +### [1.3.47](https://github.com/novlan1/t-comm/compare/v1.3.46...v1.3.47) (2023-12-25) +### Documentation 📖 +* update docs ([77b214e](https://github.com/novlan1/t-comm/commit/77b214e2e1dfcd8f46587f49f0db29767807824b)) +### Features 🎉 +* **change-log:** update insert change log ([c69b4b3](https://github.com/novlan1/t-comm/commit/c69b4b36ca659e30049b0839ddf1ffd42c72428f)) +### [1.3.46](https://github.com/novlan1/t-comm/compare/v1.3.45...v1.3.46) (2023-12-22) +### Documentation 📖 +* update docs ([cd7be3e](https://github.com/novlan1/t-comm/commit/cd7be3e04ad9d664616bd32186f9644547e87713)) +### Features 🎉 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +* **msdk:** add msdk full screen mixin ([f2c74e3](https://github.com/novlan1/t-comm/commit/f2c74e385bd87c96b57428faa1d21d239d0e465d)) ### [1.3.45](https://github.com/novlan1/t-comm/compare/v1.3.44...v1.3.45) (2023-12-21) diff --git a/docs/zh/e-bus.md b/docs/zh/e-bus.md new file mode 100644 index 00000000..3d924b3a --- /dev/null +++ b/docs/zh/e-bus.md @@ -0,0 +1,43 @@ +[[toc]] + +## 引入 + +```ts +import { initGlobalVue3EBus, initDiffVue3EBus } from 't-comm'; + +// or + +import { initGlobalVue3EBus, initDiffVue3EBus} from 't-comm/lib/e-bus/index'; +``` + + +## `initGlobalVue3EBus` + + +**描述**:
挂载统一的eBus,所有实例共用一个
+ +**参数**: + + +| 参数名 | 描述 | +| --- | --- | +| app |Vue3 应用实例
| + + + + + +## `initDiffVue3EBus` + + +**描述**:挂载唯一的eBus,不同实例用不同的
+ +**参数**: + + +| 参数名 | 描述 | +| --- | --- | +| app |Vue3 应用实例
| + + + diff --git a/docs/zh/mixin.md b/docs/zh/mixin.md index 3d894d58..bfce1072 100644 --- a/docs/zh/mixin.md +++ b/docs/zh/mixin.md @@ -3,11 +3,11 @@ ## 引入 ```ts -import { getMorsePwdMixin } from 't-comm'; +import { getMorsePwdMixin, getMsdkFullScreen } from 't-comm'; // or -import { getMorsePwdMixin} from 't-comm/lib/mixin/index'; +import { getMorsePwdMixin, getMsdkFullScreen} from 't-comm/lib/mixin/index'; ``` @@ -34,3 +34,19 @@ getMorsePwdMixin([1, 1, 1, 1, 1], function () { this.onShowLaunchApp(); }), ``` + + +## `getMsdkFullScreen()` + + +**描述**:msdk 浏览器全屏方法,点击外链时可全屏,返回时退出全屏
+ +**参数**: + + + +**示例** + +```ts +mixins: [getMsdkFullScreen()], +``` diff --git a/package.json b/package.json index ac94c5a9..2d01940e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "t-comm", - "version": "1.3.45", + "version": "1.3.48", "description": "丰富易用的工具库", "main": "lib/index.js", "module": "lib/index.esm.js", diff --git a/src/change-log/change-log.ts b/src/change-log/change-log.ts index 43814527..280ca2e6 100644 --- a/src/change-log/change-log.ts +++ b/src/change-log/change-log.ts @@ -84,7 +84,7 @@ export function insertDocChangeLog({ console.log('[insertDocChangeLog] version: ', version); if (!version) return; - const reg = new RegExp(`(\\n[#]+\\s*\\[${version}\\].*?\\n)(?=[#]+\\s*\\[\\d+\\.\\d+\\.\\d+)`, 's'); + const reg = new RegExp(`\\n([#]+\\s*\\[${version}\\].*?\\n)(?=[#]+\\s*\\[\\d+\\.\\d+\\.\\d+)`, 's'); const match = changeLog.match(reg); diff --git a/src/e-bus/e-bus.ts b/src/e-bus/e-bus.ts new file mode 100644 index 00000000..67922905 --- /dev/null +++ b/src/e-bus/e-bus.ts @@ -0,0 +1,34 @@ +export class EventBus { + private events: Record