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