From bdc81394a40349bc5ff42da2cadae1ae042fce01 Mon Sep 17 00:00:00 2001 From: mahaifeng Date: Thu, 11 Jul 2024 12:25:07 +0800 Subject: [PATCH] =?UTF-8?q?[activity-callback]=E4=BF=AE=E6=94=B9=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/SyntaxCase/utsAndroid.uvue | 80 ---------------------- pages/SystemAPI/SystemAPI.uvue | 111 +++++++++++++++++++++++++++++-- 2 files changed, 107 insertions(+), 84 deletions(-) diff --git a/pages/SyntaxCase/utsAndroid.uvue b/pages/SyntaxCase/utsAndroid.uvue index e41d4cc..8cdeac6 100644 --- a/pages/SyntaxCase/utsAndroid.uvue +++ b/pages/SyntaxCase/utsAndroid.uvue @@ -41,19 +41,6 @@ - - - - - 点击注册activity 回调方法后,可以手动切换其他APP再返回,可在控制台和界面观察事件日志 - - - - - {{ cbText }} - - - @@ -102,16 +89,10 @@ data() { return { text: '', - cbText: '', selectImage: '', - callback: [] as Any[] } }, unmounted() { - // #ifdef APP-ANDROID - this.unRegActivityCallback() - // #endif - }, onLoad: function () { // #ifdef APP-ANDROID @@ -321,67 +302,6 @@ }) }, // #endif - // #ifdef APP-ANDROID - // #ifdef UNI-APP-X - activityCallback() { - var that = this - onCallbackChange(function (eventLog : string) { - // 展示捕捉到的声明周期日志 - let nextLine = that.cbText + eventLog - that.cbText = nextLine - let nextLineFlag = that.cbText + '\n' - that.cbText = nextLineFlag - }) - let index = getCurrentPages().length - 1 - let page = getCurrentPages()[index] - console.log('page route=' + page.route) - this.callback.push(new UTSAcvitiyLifeCycleCallback()) - this.callback.push(new UTSActivityWindowCallback()) - this.callback.push(new UTSAcvitiyKeyEventCallback()) - this.callback.push(new UTSActivityCallback(), page.route) - this.callback.push(new UTSActivityComponentCallback()) - this.callback.forEach((value) => { - if (value instanceof UTSAcvitiyLifeCycleCallback) { - UTSAndroid.onActivityCallback(value,page.route) - } - if (value instanceof UTSActivityWindowCallback) { - UTSAndroid.onActivityCallback(value) - } - if (value instanceof UTSAcvitiyKeyEventCallback) { - UTSAndroid.onActivityCallback(value) - } - if (value instanceof UTSActivityCallback) { - UTSAndroid.onActivityCallback(value) - } - if (value instanceof UTSActivityComponentCallback) { - UTSAndroid.onActivityCallback(value) - } - - }) - }, - unRegActivityCallback() { - this.callback.forEach((value) => { - - if (value instanceof UTSAcvitiyLifeCycleCallback) { - UTSAndroid.offActivityCallback(value) - } - if (value instanceof UTSActivityWindowCallback) { - UTSAndroid.offActivityCallback(value) - } - if (value instanceof UTSAcvitiyKeyEventCallback) { - UTSAndroid.offActivityCallback(value) - } - if (value instanceof UTSActivityCallback) { - UTSAndroid.offActivityCallback(value) - } - if (value instanceof UTSActivityComponentCallback) { - UTSAndroid.offActivityCallback(value) - } - }) - } - // #endif - // #endif - }, } diff --git a/pages/SystemAPI/SystemAPI.uvue b/pages/SystemAPI/SystemAPI.uvue index c187377..a331d37 100644 --- a/pages/SystemAPI/SystemAPI.uvue +++ b/pages/SystemAPI/SystemAPI.uvue @@ -20,7 +20,20 @@