From 86922c08773c959ca7068f2831b2cecc67b2f614 Mon Sep 17 00:00:00 2001 From: tu6ge <772364230@qq.com> Date: Fri, 13 Aug 2021 15:58:06 +0800 Subject: [PATCH 1/2] test --- packages/shared/src/native-apis.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/shared/src/native-apis.ts b/packages/shared/src/native-apis.ts index 2b1368b7a5cb..86bad4ae5d25 100644 --- a/packages/shared/src/native-apis.ts +++ b/packages/shared/src/native-apis.ts @@ -37,6 +37,7 @@ const needPromiseApis = new Set([ 'connectSocket', 'createBLEConnection', 'downloadFile', + 'exitMiniProgram', 'getAvailableAudioSources', 'getBLEDeviceCharacteristics', 'getBLEDeviceServices', From 14a9219371fcd5c5154daf29ef9605a386c01581 Mon Sep 17 00:00:00 2001 From: tu6ge <772364230@qq.com> Date: Fri, 13 Aug 2021 16:52:07 +0800 Subject: [PATCH 2/2] feat(weapp api): add navigateToMiniProgram api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持 promise Closes: #10030 --- .../taro/types/api/open-api/navigate.d.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/taro/types/api/open-api/navigate.d.ts b/packages/taro/types/api/open-api/navigate.d.ts index 42ea2581cf8f..947c769d3a30 100644 --- a/packages/taro/types/api/open-api/navigate.d.ts +++ b/packages/taro/types/api/open-api/navigate.d.ts @@ -1,4 +1,28 @@ declare namespace Taro { + namespace exitMiniProgram { + interface Option { + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: (res: General.CallbackResult) => void + /** 接口调用失败的回调函数 */ + fail?: (res: General.CallbackResult) => void + /** 接口调用成功的回调函数 */ + success?: (res: General.CallbackResult) => void + } + } + + /** + * 退出当前小程序。必须有点击行为才能调用成功。 + * 基础库 2.17.3 开始支持 + * @supported weapp + * @example + * ```tsx + * Taro.exitMiniProgram() + * ··· + * + * @see https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html + */ + function exitMiniProgram(option: exitMiniProgram.Option): Promise + namespace navigateToMiniProgram { interface Option { /** 要打开的小程序 appId */