remaxjs / remax
1
import * as React from 'react';
2 3
import { createHostComponent } from '@remax/shared';
3
import { BaseProps, GenericEvent } from '../../types/component';
4

5
export interface OpenDataProps extends BaseProps {
6
  /** 开放数据类型 1.4.0 */
7
  type?:
8
    | 'groupName'
9
    | 'userNickName'
10
    | 'userAvatarUrl'
11
    | 'userGender'
12
    | 'userCity'
13
    | 'userProvince'
14
    | 'userCountry'
15
    | 'userLanguage';
16
  /** 当 type="groupName" 时生效, 群id 1.4.0 */
17
  openGid?: string;
18
  /** (default: en) 当 type="user*" 时生效,以哪种语言展示 userInfo 1.4.0 */
19
  lang?: 'en' | 'zh_CN' | 'zh_TW';
20
  /** 数据为空时的默认文案 2.8.1 */
21
  defaultText?: string;
22
  /** 用户头像为空时的默认图片,支持相对路径和网络图片路径 2.8.1 */
23
  defaultAvatar?: string;
24
  /** 群名称或用户信息为空时触发 2.8.1 */
25
  onError?: (event: GenericEvent) => any;
26
}
27
/**
28
 * https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html
29
 */
30 3
export const OpenData: React.ComponentType<OpenDataProps> = createHostComponent<OpenDataProps>('open-data');
31

32 3
OpenData.defaultProps = {
33
  lang: 'en',
34
};

Read our documentation on viewing source code .

Loading