badge.nvue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="page">
  3. <text class="example-info">数字角标通用来标记重点信息使用,如接受到新消息、有未读消息等</text>
  4. <uni-section title="有底色" type="line"></uni-section>
  5. <view class="example-body">
  6. <uni-badge class="uni-badge-left-margin" text="1" />
  7. <uni-badge class="uni-badge-left-margin" text="2" type="primary" />
  8. <uni-badge class="uni-badge-left-margin" text="34" type="success" />
  9. <uni-badge class="uni-badge-left-margin" text="45" type="warning" />
  10. <uni-badge class="uni-badge-left-margin" text="123" type="error" />
  11. </view>
  12. <uni-section title="无底色" type="line"></uni-section>
  13. <view class="example-body">
  14. <uni-badge class="uni-badge-left-margin" :inverted="true" text="1" />
  15. <uni-badge class="uni-badge-left-margin" :inverted="true" text="2" type="primary" />
  16. <uni-badge class="uni-badge-left-margin" :inverted="true" text="34" type="success" />
  17. <uni-badge class="uni-badge-left-margin" :inverted="true" text="45" type="warning" />
  18. <uni-badge class="uni-badge-left-margin" :inverted="true" text="123" type="error" />
  19. </view>
  20. <uni-section title="迷你" type="line"></uni-section>
  21. <view class="example-body">
  22. <uni-badge class="uni-badge-left-margin" text="1" size="small" />
  23. <uni-badge class="uni-badge-left-margin" text="2" type="primary" size="small" />
  24. <uni-badge class="uni-badge-left-margin" text="34" type="success" size="small" />
  25. <uni-badge class="uni-badge-left-margin" text="45" type="warning" size="small" />
  26. <uni-badge class="uni-badge-left-margin" text="123" type="error" size="small" />
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. components: {},
  33. data() {
  34. return {};
  35. }
  36. };
  37. </script>
  38. <style>
  39. @charset "UTF-8";
  40. /* 头条小程序组件内不能引入字体 */
  41. /* #ifdef MP-TOUTIAO */
  42. @font-face {
  43. font-family: uniicons;
  44. font-weight: normal;
  45. font-style: normal;
  46. src: url("~@/static/uni.ttf") format("truetype");
  47. }
  48. /* #endif */
  49. /* #ifndef APP-NVUE */
  50. page {
  51. display: flex;
  52. flex-direction: column;
  53. box-sizing: border-box;
  54. background-color: #efeff4;
  55. min-height: 100%;
  56. height: auto;
  57. }
  58. view {
  59. font-size: 14px;
  60. line-height: inherit;
  61. }
  62. .example {
  63. padding: 0 15px 15px;
  64. }
  65. .example-info {
  66. padding: 15px;
  67. color: #3b4144;
  68. background: #ffffff;
  69. }
  70. .example-body {
  71. /* #ifndef APP-NVUE */
  72. display: flex;
  73. /* #endif */
  74. flex-direction: row;
  75. flex-wrap: wrap;
  76. justify-content: center;
  77. padding: 0;
  78. font-size: 14px;
  79. background-color: #ffffff;
  80. }
  81. /* #endif */
  82. .example {
  83. padding: 0 15px;
  84. }
  85. .example-info {
  86. /* #ifndef APP-NVUE */
  87. display: block;
  88. /* #endif */
  89. padding: 15px;
  90. color: #3b4144;
  91. background-color: #ffffff;
  92. font-size: 14px;
  93. line-height: 20px;
  94. }
  95. .example-info-text {
  96. font-size: 14px;
  97. line-height: 20px;
  98. color: #3b4144;
  99. }
  100. .example-body {
  101. flex-direction: column;
  102. padding: 15px;
  103. background-color: #ffffff;
  104. }
  105. .word-btn-white {
  106. font-size: 18px;
  107. color: #FFFFFF;
  108. }
  109. .word-btn {
  110. /* #ifndef APP-NVUE */
  111. display: flex;
  112. /* #endif */
  113. flex-direction: row;
  114. align-items: center;
  115. justify-content: center;
  116. border-radius: 6px;
  117. height: 48px;
  118. margin: 15px;
  119. background-color: #007AFF;
  120. }
  121. .word-btn--hover {
  122. background-color: #4ca2ff;
  123. }
  124. /* #ifdef MP-ALIPAY */
  125. .uni-badge {
  126. margin-left: 20rpx;
  127. }
  128. /* #endif */
  129. .example-body {
  130. flex-direction: row;
  131. justify-content: flex-start;
  132. }
  133. .uni-badge-left-margin {
  134. margin-left: 20rpx;
  135. }
  136. </style>