pagination.nvue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view>
  3. <uni-section title="默认样式" type="line"></uni-section>
  4. <view class="example-body">
  5. <uni-pagination :total="50" title="标题文字" />
  6. </view>
  7. <uni-section title="修改按钮文字" type="line"></uni-section>
  8. <view class="example-body">
  9. <uni-pagination :total="50" title="标题文字" prev-text="前一页" next-text="后一页" />
  10. </view>
  11. <uni-section title="图标样式" type="line"></uni-section>
  12. <view class="example-body">
  13. <uni-pagination :show-icon="true" :total="50" title="标题文字" />
  14. </view>
  15. <uni-section title="修改数据长度" type="line"></uni-section>
  16. <view class="example-body">
  17. <uni-pagination :current="current" :total="total" title="标题文字" :show-icon="true" @change="change" />
  18. </view>
  19. <view class="btn-view">
  20. <view>
  21. <text class="example-info">当前页:{{ current }},数据总量:{{ total }}条,每页数据:{{ pageSize }}</text>
  22. </view>
  23. <view class="button word-btn" hover-class="word-btn--hover" :hover-start-time="20" :hover-stay-time="70" @click="add"><text class="word-btn-white">增加10条数据</text></view>
  24. <button class="button" type="default" @click="reset">重置数据</button>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. components: {},
  31. data() {
  32. return {
  33. current: 1,
  34. total: 0,
  35. pageSize: 10
  36. }
  37. },
  38. methods: {
  39. add() {
  40. this.total += 10
  41. },
  42. reset() {
  43. this.total = 0
  44. this.current = 1
  45. },
  46. change(e) {
  47. console.log(e)
  48. this.current = e.current
  49. }
  50. }
  51. }
  52. </script>
  53. <style>
  54. @charset "UTF-8";
  55. /* 头条小程序组件内不能引入字体 */
  56. /* #ifdef MP-TOUTIAO */
  57. @font-face {
  58. font-family: uniicons;
  59. font-weight: normal;
  60. font-style: normal;
  61. src: url("~@/static/uni.ttf") format("truetype");
  62. }
  63. /* #endif */
  64. /* #ifndef APP-NVUE */
  65. page {
  66. display: flex;
  67. flex-direction: column;
  68. box-sizing: border-box;
  69. background-color: #efeff4;
  70. min-height: 100%;
  71. height: auto;
  72. }
  73. view {
  74. font-size: 14px;
  75. line-height: inherit;
  76. }
  77. .example {
  78. padding: 0 15px 15px;
  79. }
  80. .example-info {
  81. padding: 15px;
  82. color: #3b4144;
  83. background: #ffffff;
  84. }
  85. .example-body {
  86. /* #ifndef APP-NVUE */
  87. display: flex;
  88. /* #endif */
  89. flex-direction: row;
  90. flex-wrap: wrap;
  91. justify-content: center;
  92. padding: 0;
  93. font-size: 14px;
  94. background-color: #ffffff;
  95. }
  96. /* #endif */
  97. .example {
  98. padding: 0 15px;
  99. }
  100. .example-info {
  101. /* #ifndef APP-NVUE */
  102. display: block;
  103. /* #endif */
  104. padding: 15px;
  105. color: #3b4144;
  106. background-color: #ffffff;
  107. font-size: 14px;
  108. line-height: 20px;
  109. }
  110. .example-info-text {
  111. font-size: 14px;
  112. line-height: 20px;
  113. color: #3b4144;
  114. }
  115. .example-body {
  116. flex-direction: column;
  117. padding: 15px;
  118. background-color: #ffffff;
  119. }
  120. .word-btn-white {
  121. font-size: 18px;
  122. color: #FFFFFF;
  123. }
  124. .word-btn {
  125. /* #ifndef APP-NVUE */
  126. display: flex;
  127. /* #endif */
  128. flex-direction: row;
  129. align-items: center;
  130. justify-content: center;
  131. border-radius: 6px;
  132. height: 48px;
  133. margin: 15px;
  134. background-color: #007AFF;
  135. }
  136. .word-btn--hover {
  137. background-color: #4ca2ff;
  138. }
  139. .example-body {
  140. /* #ifndef APP-NVUE */
  141. display: block;
  142. /* #endif */
  143. }
  144. .btn-view {
  145. /* #ifndef APP-NVUE */
  146. display: flex;
  147. flex-direction: column;
  148. /* #endif */
  149. padding: 15px;
  150. text-align: center;
  151. background-color: #fff;
  152. justify-content: center;
  153. align-items: center;
  154. }
  155. .button {
  156. margin-bottom: 20px;
  157. width: 350px;
  158. }
  159. </style>