marketplace - 副本.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <uni-table class="table-box" emptyText="暂无更多数据">
  3. <!-- 表头行 -->
  4. <uni-tr>
  5. <uni-th>
  6. <view class="table-th">
  7. 交易对
  8. </view>
  9. </uni-th>
  10. <uni-th >
  11. <view class="table-th table-th-title" @click.stop="alterRankRule(`rankRule`)">
  12. <text>最新价</text>
  13. <view class="title-arrows">
  14. <image class="arrows-icon" :src="rankRule === 1 ? activeRankRuleIcon : rankRuleIcon"
  15. mode="aspectFit"></image>
  16. <image class="arrows-icon" :src="rankRule === 2 ? activeRankRuleIcon : rankRuleIcon"
  17. mode="aspectFit"></image>
  18. </view>
  19. </view>
  20. </uni-th>
  21. <uni-th >
  22. <view class="table-th table-th-title" @click.stop="alterRankRule(`rankRule`)">
  23. <text>日涨跌</text>
  24. <view class="title-arrows">
  25. <image class="arrows-icon" :src="rankRule === 1 ? activeRankRuleIcon : rankRuleIcon"
  26. mode="aspectFit"></image>
  27. <image class="arrows-icon" :src="rankRule === 2 ? activeRankRuleIcon : rankRuleIcon"
  28. mode="aspectFit"></image>
  29. </view>
  30. </view>
  31. </uni-th>
  32. </uni-tr>
  33. <!-- 表格数据行 -->
  34. <uni-tr v-for="item in 30" :rise-fall="stocksColor">
  35. <uni-td>
  36. <view class="table-title">
  37. <view class="title">
  38. <text>BTC</text>
  39. <text class="title-sub">/USDT</text>
  40. </view>
  41. <view class="title-num">
  42. 24H额:476.62m
  43. </view>
  44. </view>
  45. </uni-td>
  46. <uni-td>
  47. <view class="title">
  48. <view class="">
  49. 30188.2
  50. </view>
  51. <view class="title-num">
  52. ¥207695.01
  53. </view>
  54. </view>
  55. </uni-td>
  56. <uni-td class="table-right">
  57. <view class="table-btn-box">
  58. <view :class="['table-btn' , item % 2 ? 'fall-btn' : 'rise-btn']">
  59. +0.03%
  60. </view>
  61. </view>
  62. </uni-td>
  63. </uni-tr>
  64. </uni-table>
  65. </template>
  66. <script>
  67. import {
  68. mapGetters
  69. } from 'vuex'
  70. export default {
  71. name: "marketplace",
  72. data() {
  73. return {
  74. rankRule: 0,
  75. rankRuleIcon: require("@/static/images/jiantou.png"),
  76. activeRankRuleIcon: require("@/static/images/jiantou_01.png")
  77. };
  78. },
  79. computed: {
  80. ...mapGetters([
  81. 'stocksColor'
  82. ]),
  83. },
  84. methods: {
  85. alterRankRule(rankRule) {
  86. console.log('alterRankRule' , rankRule)
  87. switch (this['rankRule']) {
  88. case 0:
  89. this['rankRule'] = 1;
  90. break;
  91. case 1:
  92. this['rankRule'] = 2;
  93. break;
  94. default:
  95. this['rankRule'] = 0
  96. }
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .table-box {
  103. .uni-table-tr {
  104. .uni-table-th,
  105. .uni-table-td {
  106. padding: 0;
  107. flex-shrink: 0;
  108. &:nth-child(3n - 2) {
  109. padding-left: $pages-padding;
  110. flex: 2;
  111. }
  112. &:nth-child(3n - 1) {
  113. text-align: right !important;
  114. flex: 2;
  115. }
  116. &:nth-child(3n) {
  117. flex: 1;
  118. padding-right: $pages-padding;
  119. }
  120. // &:nth-child()
  121. }
  122. .table-th{
  123. padding-top: 20rpx;
  124. padding-bottom: 10rpx;
  125. }
  126. .uni-table-th {
  127. font-size: 22rpx;
  128. border-bottom: none;
  129. .table-th-title {
  130. width: 100%;
  131. display: flex;
  132. justify-content: flex-end;
  133. .title-arrows {
  134. display: flex;
  135. flex-direction: column;
  136. align-items: center;
  137. justify-content: flex-end;
  138. padding-left: 3px;
  139. .arrows-icon {
  140. width: 18rpx;
  141. height: 18rpx;
  142. &:first-child {
  143. transform: rotate(180deg);
  144. margin-bottom: -4rpx;
  145. }
  146. &:last-child {
  147. margin-top: -4rpx;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. .uni-table-td {
  154. padding-top: 20rpx;
  155. padding-bottom: 20rpx;
  156. .table-title {
  157. width: 100%;
  158. line-height: 1.2;
  159. }
  160. .title {
  161. line-height: 1.2;
  162. font-size: 28rpx;
  163. font-family: PingFang SC, PingFang SC-Bold;
  164. font-weight: 700;
  165. .title-sub {
  166. font-size: 24rpx;
  167. font-weight: 400;
  168. }
  169. }
  170. .title-num {
  171. padding-top: 18rpx;
  172. font-size: 24rpx;
  173. }
  174. // <view class="table-title">
  175. // <view class="title">
  176. // <text>BTC</text>
  177. // <text class="title-sub">/USDT</text>
  178. // </view>
  179. // <view class="title-num">
  180. // 24H额:476.62m
  181. // </view>
  182. // </view>
  183. // &:nth-child(3n - 2) {
  184. // padding-left: $pages-padding;
  185. // }
  186. // &:nth-child(3n) {
  187. // padding-right: $pages-padding;
  188. // background-color: yellow;
  189. // text-align: right;
  190. // }
  191. // &:nth-child()
  192. }
  193. .table-btn-box {
  194. // width: 100%;
  195. // height: 100%;
  196. // display: flex;
  197. // justify-content: flex-end;
  198. // align-items: center;
  199. // background-color: yellowgreen;
  200. }
  201. .table-btn {
  202. // 138
  203. // width: 138rpx;
  204. // height: 60rpx;
  205. border-radius: 6rpx;
  206. color: #fff;
  207. font-family: PingFang SC, PingFang SC-Bold;
  208. font-weight: 700;
  209. text-align: center;
  210. // line-height: 60rpx;
  211. font-size: 26rpx;
  212. // margin-left: calc(100% - 138rpx);
  213. }
  214. }
  215. .table-right {
  216. padding: 0 !important;
  217. // display: flex;
  218. // justify-content: flex-end;
  219. // align-items: center;
  220. }
  221. }
  222. </style>