1 | import { ComponentType } from 'react'
|
2 | import { StandardProps, CommonEventFunction } from './common'
|
3 |
|
4 | interface OfficialAccountProps extends StandardProps {
|
5 | /** 组件加载成功时触发
|
6 | * @supported weapp
|
7 | */
|
8 | onLoad?: CommonEventFunction<OfficialAccountProps.Detail>
|
9 |
|
10 | /** 组件加载失败时触发
|
11 | * @supported weapp
|
12 | */
|
13 | onError?: CommonEventFunction<OfficialAccountProps.Detail>
|
14 | }
|
15 |
|
16 | declare namespace OfficialAccountProps {
|
17 | /** detail 对象 */
|
18 | interface Detail {
|
19 | /** 状态码 */
|
20 | status: number
|
21 | /** 错误信息 */
|
22 | errMsg: string
|
23 | }
|
24 | /** status 有效值 */
|
25 | interface Status {
|
26 | /** 网络错误 */
|
27 | '-2'
|
28 | /** 数据解析错误 */
|
29 | '-1'
|
30 | /** 加载成功 */
|
31 | 0
|
32 | /** 小程序关注公众号功能被封禁 */
|
33 | 1
|
34 | /** 关联公众号被封禁 */
|
35 | 2
|
36 | /** 关联关系解除或未选中关联公众号 */
|
37 | 3
|
38 | /** 未开启关注公众号功能 */
|
39 | 4
|
40 | /** 场景值错误 */
|
41 | 5
|
42 | /** 重复创建 */
|
43 | 6
|
44 | }
|
45 | }
|
46 |
|
47 | /** 公众号关注组件。当用户扫小程序码打开小程序时,开发者可在小程序内配置公众号关注组件,方便用户快捷关注公众号,可嵌套在原生组件内。
|
48 | *
|
49 | * Tips
|
50 | * 使用组件前,需前往小程序后台,在“设置”->“关注公众号”中设置要展示的公众号。注:设置的公众号需与小程序主体一致。
|
51 | *
|
52 | * 在一个小程序的生命周期内,只有从以下场景进入小程序,才具有展示引导关注公众号组件的能力:
|
53 | *
|
54 | * 当小程序从扫小程序码场景(场景值1047,场景值1124)打开时
|
55 | * 当小程序从聊天顶部场景(场景值1089)中的「最近使用」内打开时,若小程序之前未被销毁,则该组件保持上一次打开小程序时的状态
|
56 | * 当从其他小程序返回小程序(场景值1038)时,若小程序之前未被销毁,则该组件保持上一次打开小程序时的状态
|
57 | * @classification open
|
58 | * @supported weapp
|
59 | * @see https://developers.weixin.qq.com/miniprogram/dev/component/official-account.html
|
60 | */
|
61 | declare const OfficialAccount: ComponentType<OfficialAccountProps>
|
62 |
|
63 | export { OfficialAccount, OfficialAccountProps }
|