支付宝小程序引导组件 标签·Tag

2020-09-18 11:22 更新

突出利益点、以及属性说明的标签。

扫码体验

示例代码

  1. {
  2. "defaultTitle": "Tag",
  3. "usingComponents": {
  4. "tag": "mini-ali-ui/es/tag/index",
  5. "list-item": "mini-ali-ui/es/list/list-item/index",
  6. "am-switch": "mini-ali-ui/es/am-switch/index"
  7. }
  8. }
  9. <view style="padding: 12px;">
  10. <view style="display: flex; justify-content: space-evenly;">
  11. <tag size="lg" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="primary">标签</tag>
  12. <tag size="lg" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="warning">标签</tag>
  13. <tag size="lg" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="danger">标签</tag>
  14. <tag size="lg" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="success">标签</tag>
  15. </view>
  16. <view style="display: flex; justify-content: space-evenly; margin-top: 20px;">
  17. <tag size="sm" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="primary">标签</tag>
  18. <tag size="sm" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="warning">标签</tag>
  19. <tag size="sm" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="danger">标签</tag>
  20. <tag size="sm" iconType="{{useIcon ? 'qr' : ''}}" ghost="{{ghost}}" type="success">标签</tag>
  21. </view>
  22. <view style="padding: 20px 10px;">
  23. <list-item>
  24. 图标
  25. <am-switch slot="extra" onChange="setInfo" data-name="useIcon" checked="{{useIcon}}"/>
  26. </list-item>
  27. <list-item>
  28. 线框样式
  29. <am-switch slot="extra" onChange="setInfo" data-name="ghost" checked="{{ghost}}"/>
  30. </list-item>
  31. </view>
  32. </view>
  1. Page({
  2. data: {},
  3. onLoad() {},
  4. setInfo(e) {
  5. const { dataset } = e.target;
  6. const { name } = dataset;
  7. this.setData({
  8. [name]: e.detail.value,
  9. });
  10. },
  11. });

属性

属性 类型 默认值 描述
className String - 类名称。
type String primary 标签类型。可选值:primary、success、warning、danger。
iconType String - 图标类型。
size String lg 标签大小。可选值:lg、sm。
ghost Boolean false 是否显示为线框的 tag 样式。可选值:true、false。

slots

slotName 描述
- 标签内部文案。
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号