徽标 Badge

基本

  1. <za-cell has-arrow title="点状">
  2. <za-badge slot="description" shape="dot" @click="handleClick"></za-badge>
  3. </za-cell>
  4. <za-cell has-arrow title="直角">
  5. <za-badge slot="description" text="免费"></za-badge>
  6. </za-cell>
  7. <za-cell has-arrow title="圆角">
  8. <za-badge slot="description" text="new" shape="radius"></za-badge>
  9. </za-cell>
  10. <za-cell has-arrow title="椭圆">
  11. <span slot="description">
  12. <za-badge text="999+" shape="round"></za-badge>
  13. </span>
  14. </za-cell>
  15. <za-cell has-arrow title="圆形">
  16. <span slot="description">
  17. <za-badge :text.number="3" shape="circle"></za-badge>
  18. </span>
  19. </za-cell>
  20. <za-cell has-arrow title="叶形">
  21. <span slot="description">
  22. <za-badge text="新品" shape="leaf"></za-badge>
  23. </span>
  24. </za-cell>

多主题

  1. <div class="custom-panel">
  2. <div class="box">
  3. <za-badge sup shape="dot" theme="primary"></za-badge>
  4. </div>
  5. <div class="box">
  6. <za-badge sup shape="dot" theme="success"></za-badge>
  7. </div>
  8. <div class="box">
  9. <za-badge sup shape="dot" theme="warning"></za-badge>
  10. </div>
  11. <div class="box">
  12. <za-badge sup shape="dot" theme="error"></za-badge>
  13. </div>
  14. <div class="box">
  15. <za-badge shape="round" text="999+" theme="primary"></za-badge>
  16. </div>
  17. <div class="box">
  18. <za-badge shape="round" text="999+" theme="success"></za-badge>
  19. </div>
  20. <div class="box">
  21. <za-badge shape="round" text="999+" theme="warning"></za-badge>
  22. </div>
  23. <div class="box">
  24. <za-badge shape="round" text="999+" theme="error"></za-badge>
  25. </div>
  26. </div>

上标位置

<div class="custom-panel">
  <div class="box">
    <za-badge sup shape="dot" @click="handleClick">
      <div class="box-item"></div>
    </za-badge>
  </div>
  <div class="box">
    <za-badge sup shape="rect" text="免费" @click="handleClick">
      <div class="box-item"></div>
    </za-badge>
  </div>
  <div class="box">
    <za-badge sup shape="radius" text="new" @click="handleClick">
      <div class="box-item"></div>
    </za-badge>
  </div>
  <div class="box">
    <za-badge sup shape="round" text="999+" @click="handleClick">
      <div class="box-item"></div>
    </za-badge>
  </div>
  <div class="box">
    <za-badge sup shape="circle" text="3" @click="handleClick">
      <div class="box-item"></div>
    </za-badge>
  </div>
  <div class="box">
    <za-badge sup shape="leaf" text="新品" @click="handleClick">
      <div class="box-item"></div>
    </za-badge>
  </div>
</div>

文本示例

<div class="text-panel">
  <div class="box">
    <za-badge sup shape="dot">
      <span class="box-text">邀请有奖</span>
    </za-badge>
  </div>
  <div class="box">
    <span class="box-text">邀请有奖</span>
    <za-badge sup shape="dot">
  </za-badge></div>
</div>

Vue Script

<script name="vue">
export default {
  data() {
    return {
    }
  },
  methods: {
    handleClick(e) {
      console.log(e);
    },
  },
};
</script>

API

Badge Attributes

属性类型默认值可选值/参数说明
themestring'error''default', 'primary', 'success', 'warning', 'error'主题
shapestring'dot', 'rect', 'radius', 'round', 'circle', 'leaf'形状
textstring, number显示文字
supbooleanfalse是否上标位置

Badge Events

事件名称说明回调参数
clickclick 时触发的事件event 事件对象

Badge 徽标 - 图1