UNPKG

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