iconItem.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view>
  3. <view class="padding text-center">
  4. <block v-if="item.text && item.text != 0">
  5. <uni-badge class="uni-badge-left-margin" :text="item.text" absolute="rightTop" :offset="[-3, -3]"
  6. size="small" :custom-style="customStyle">
  7. <image :src="item.icon" style="width:28px;height:28px;">
  8. <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em" v-if="getTtemDotInfo(item)">
  9. <block v-if="getTtemDotInfo(item)">{{getTtemDotInfo(item)}}</block>
  10. </view>
  11. </image>
  12. </uni-badge>
  13. </block>
  14. <block v-else>
  15. <image :src="item.icon" style="width:28px;height:28px;">
  16. <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em" v-if="getTtemDotInfo(item)">
  17. <block v-if="getTtemDotInfo(item)">{{getTtemDotInfo(item)}}</block>
  18. </view>
  19. </image>
  20. </block>
  21. <view class="margin-top-xs">{{item.title}}</view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. item: {
  29. type: Object,
  30. default: () => {}
  31. }
  32. },
  33. data() {
  34. return {
  35. customStyle: {
  36. backgroundColor: '#dd524d',
  37. color: '#fff'
  38. }
  39. }
  40. },
  41. methods: {
  42. getTtemDotInfo(item) {
  43. if (item.page === 'annotationList' && this.msgCount > 0) {
  44. return this.msgCount
  45. }
  46. return '';
  47. },
  48. }
  49. }
  50. </script>
  51. <style scoped lang="scss">
  52. </style>