From 5190f96a94a10e361115eacb3e7a87fb30205b41 Mon Sep 17 00:00:00 2001 From: bigMeow Date: Wed, 15 Feb 2023 00:46:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?chore(type):=20useShareAppMessage=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89=E6=94=AF=E6=8C=81=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E5=BC=82=E6=AD=A5=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro/types/taro.lifecycle.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/taro/types/taro.lifecycle.d.ts b/packages/taro/types/taro.lifecycle.d.ts index 95cdbc04763e..63f7271b8c71 100644 --- a/packages/taro/types/taro.lifecycle.d.ts +++ b/packages/taro/types/taro.lifecycle.d.ts @@ -85,7 +85,7 @@ declare module './index' { webViewUrl?: string } - interface ShareAppMessageReturn { + interface ShareAppMessageReturnObject { /** * 转发标题,默认为当前小程序名称 */ @@ -107,6 +107,8 @@ declare module './index' { imageUrl?: string } + type ShareAppMessageReturn = ShareAppMessageReturnObject | Promise + interface TabItemTapObject { /** * 被点击tabItem的序号,从 0 开始 From 433d89a8528dee50d6775a9d33ea68ead09d6a13 Mon Sep 17 00:00:00 2001 From: bigMeow Date: Wed, 15 Feb 2023 01:43:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(type):=20useShareAppMessage=20?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=AF=B9=E8=B1=A1=E4=B8=AD=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20'promise'=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro/types/taro.lifecycle.d.ts | 35 ++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/packages/taro/types/taro.lifecycle.d.ts b/packages/taro/types/taro.lifecycle.d.ts index 63f7271b8c71..849bcd7ef24e 100644 --- a/packages/taro/types/taro.lifecycle.d.ts +++ b/packages/taro/types/taro.lifecycle.d.ts @@ -107,7 +107,40 @@ declare module './index' { imageUrl?: string } - type ShareAppMessageReturn = ShareAppMessageReturnObject | Promise + interface WeappShareAppMessageReturnObject extends ShareAppMessageReturnObject{ + /** + * 如果该参数存在,则以 resolve 结果为准,如果三秒内不 resolve,分享会使用上面传入的默认参数 + * @supported weapp + * @since 2.12.0 + * @see https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onShareAppMessage-Object-object + * @example + * ```tsx + * import { ShareAppMessageReturnObject, useShareAppMessage } from "@tarojs/taro"; + * // ... else code + * useShareAppMessage(() => { + * const p = new Promise(resolve => { + * setTimeout(() => { + * resolve({ + * title: "", + * imageUrl: "", + * path: "" + * }) + * }, 2000) + * }) + * return { + * title: "", + * imageUrl: "", + * path: "", + * promise: p + * } + * }); + * ``` + * + */ + promise?: Promise + } + + type ShareAppMessageReturn = ShareAppMessageReturnObject | Promise | WeappShareAppMessageReturnObject interface TabItemTapObject { /** From bf035e094c35ab2abc581ab60db9993b78d05e63 Mon Sep 17 00:00:00 2001 From: Zakary Date: Fri, 3 Mar 2023 15:55:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix(types):=20=E4=BC=98=E5=8C=96=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E7=94=9F=E5=91=BD=E5=91=A8=E6=9C=9F=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro/types/taro.lifecycle.d.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/taro/types/taro.lifecycle.d.ts b/packages/taro/types/taro.lifecycle.d.ts index 849bcd7ef24e..b5bd97f3ee14 100644 --- a/packages/taro/types/taro.lifecycle.d.ts +++ b/packages/taro/types/taro.lifecycle.d.ts @@ -67,20 +67,14 @@ declare module './index' { * 转发事件来源 * `button`:页面内转发按钮 * `menu`:右上角转发菜单 - * - * @since 1.2.4 */ from?: 'button' | 'menu' | string /** * 如果 `from` 值是 `button`,则 `target` 是触发这次转发事件的 `button`,否则为 `undefined` - * - * @since 1.2.4 */ target?: object /** * 页面中包含 `` 组件时,返回当前 `` 的 url - * - * @since 1.6.4 */ webViewUrl?: string } @@ -101,17 +95,14 @@ declare module './index' { * 支持PNG及JPG * 显示图片长宽比是 5:4 * 默认使用截图 - * - * @since 1.5.0 */ imageUrl?: string } - interface WeappShareAppMessageReturnObject extends ShareAppMessageReturnObject{ + interface WeappShareAppMessageReturnObject extends ShareAppMessageReturnObject { /** * 如果该参数存在,则以 resolve 结果为准,如果三秒内不 resolve,分享会使用上面传入的默认参数 * @supported weapp - * @since 2.12.0 * @see https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onShareAppMessage-Object-object * @example * ```tsx @@ -135,9 +126,9 @@ declare module './index' { * } * }); * ``` - * + * */ - promise?: Promise + promise: Promise } type ShareAppMessageReturn = ShareAppMessageReturnObject | Promise | WeappShareAppMessageReturnObject