UNPKG

2.85 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StandardProps } from './common'
3interface IconProps extends StandardProps {
4 /** icon 的类型
5 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn
6 */
7 type: keyof IconProps.TIconType
8
9 /** icon 的大小,单位px
10 * @default 23
11 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn
12 */
13 size?: string
14
15 /** icon 的颜色,同 css 的 color
16 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn
17 */
18 color?: string
19
20 /** 无障碍访问,(属性)元素的额外描述
21 * @supported qq
22 */
23 ariaLabel?: string
24}
25declare namespace IconProps {
26 /** icon 的类型 */
27 interface TIconType {
28 /** 成功图标 */
29 success
30
31 /** 成功图标(不带外圈) */
32 success_no_circle
33
34 /** 信息图标 */
35 info
36
37 /** 警告图标 */
38 warn
39
40 /** 等待图标 */
41 waiting
42
43 /** 取消图标 */
44 cancel
45
46 /** 下载图标 */
47 download
48
49 /** 搜索图标 */
50 search
51
52 /** 清除图标 */
53 clear
54
55 /** 圆环图标(多选控件图标未选择)「微信文档未标注属性」 */
56 circle
57
58 /** 带圆环的信息图标「微信文档未标注属性」 */
59 info_circle
60 }
61}
62
63/** 图标。组件属性的长度单位默认为 px
64 * @classification base
65 * @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
66 * @example_react
67 * ```tsx
68 * export default class PageView extends Component {
69 * constructor() {
70 * super(...arguments)
71 * }
72 *
73 * render() {
74 * return (
75 * <View className='components-page'>
76 * <Icon size='60' type='success' />
77 * <Icon size='60' type='info' />
78 * <Icon size='60' type='warn' color='#ccc' />
79 * <Icon size='60' type='warn' />
80 * <Icon size='60' type='waiting' />
81 * <Icon size='20' type='success_no_circle' />
82 * <Icon size='20' type='warn' />
83 * <Icon size='20' type='success' />
84 * <Icon size='20' type='download' />
85 * <Icon size='20' type='clear' color='red' />
86 * <Icon size='20' type='search' />
87 * </View>
88 * )
89 * }
90 * }
91 * ```
92 * @example_vue
93 * <template>
94 * <view class="components-page">
95 * <icon size="60" type="success" />
96 * <icon size="60" type="info" />
97 * <icon size="60" type="warn" color="#ccc" />
98 * <icon size="60" type="warn" />
99 * <icon size="60" type="waiting" />
100 * <icon size="20" type="success_no_circle" />
101 * <icon size="20" type="warn" />
102 * <icon size="20" type="success" />
103 * <icon size="20" type="download" />
104 * <icon size="20" type="clear" color="red" />
105 * <icon size="20" type="search" />
106 * </view>
107 * </template>
108 * @see https://developers.weixin.qq.com/miniprogram/dev/component/icon.html
109 */
110declare const Icon: ComponentType<IconProps>
111export { Icon, IconProps }