Icon

图标

属性

属性名类型默认值说明
typeStringicon 的类型,有效值:success, success_no_circle, info, warn, waiting, cancel, download, search, clear
sizeNumber23icon 的大小,单位 px
colorColoricon 的颜色,同 css 的 color

各端支持度

属性微信小程序H5ReactNative百度小程序支付宝小程序字节跳动小程序
type
size
color
示例:
  1. import Taro, { Component } from '@tarojs/taro'
  2. import { View, Icon } from '@tarojs/components'
  3. export default class PageView extends Component {
  4. constructor() {
  5. super(...arguments)
  6. }
  7. render() {
  8. return (
  9. <View className='components-page'>
  10. <Icon size='60' type='success' />
  11. <Icon size='60' type='info' />
  12. <Icon size='60' type='warn' color='#ccc' />
  13. <Icon size='60' type='warn' />
  14. <Icon size='60' type='waiting' />
  15. <Icon size='20' type='success_no_circle' />
  16. <Icon size='20' type='warn' />
  17. <Icon size='20' type='success' />
  18. <Icon size='20' type='download' />
  19. <Icon size='20' type='clear' color='red' />
  20. <Icon size='20' type='search' />
  21. </View>
  22. )
  23. }
  24. }