Y-Steps.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <!-- 获取一个数组,结构为[{date:'时间',info:'内容内容'}] -->
  3. <!-- @click事件返回点击标签元素的索引值 第一项为0 -->
  4. <view class="bg">
  5. <view class="steps">
  6. <view class="steps_item" v-for="(i, index) in infoList">
  7. <view class="s_r">
  8. <view class="line" :style="{backgroundColor:index != 0?backgroundColor:'rgba(0,0,0,0)'}"></view>
  9. <view class="index" :style="{backgroundColor:backgroundColor,color:color}">
  10. {{ index + 1 }}
  11. </view>
  12. <view class="line" :style="{backgroundColor:index != infoList.length-1?backgroundColor:'rgba(0,0,0,0)'}"></view>
  13. </view>
  14. <view class="s_l">
  15. <view class="info_item" @tap="topage(index)">
  16. <view class="label">
  17. {{ i.date }}:
  18. <text>
  19. 开发者
  20. </text>
  21. </view>
  22. <view class="inner">{{ i.info }}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. name: 'YSteps',
  32. props: {
  33. infoList: {
  34. type: Array,
  35. default: []
  36. },
  37. color: {
  38. type: String,
  39. default: '#fff'
  40. },
  41. backgroundColor: {
  42. type: String,
  43. default: '#ff3838'
  44. }
  45. },
  46. data() {
  47. return {};
  48. },
  49. onLoad(e) {
  50. //获取列表
  51. },
  52. methods: {
  53. topage(e) {
  54. this.$emit('click', e);
  55. }
  56. }
  57. };
  58. </script>
  59. <style lang="scss" scoped>
  60. .bg {
  61. // margin: 20upx 0;
  62. // background-color: #f2f2f2;
  63. display: flex;
  64. }
  65. .steps {
  66. display: flex;
  67. flex-direction: column;
  68. .steps_item {
  69. display: flex;
  70. .s_r {
  71. padding: 0 20rpx;
  72. display: flex;
  73. flex-direction: column;
  74. align-items: center;
  75. .line {
  76. flex: 1;
  77. width: 5rpx;
  78. background-color: #fff;
  79. }
  80. .index {
  81. width: 40rpx;
  82. height: 40rpx;
  83. font-size: 12px;
  84. text-align: center;
  85. line-height: 40rpx;
  86. border-radius: 50rpx;
  87. }
  88. }
  89. .s_l {
  90. display: flex;
  91. flex-direction: column;
  92. padding: 20rpx 0;
  93. .info_item {
  94. background-color: #FFFFFF;
  95. margin-right: 30upx;
  96. border-radius: 10upx;
  97. display: flex;
  98. flex-direction: column;
  99. justify-content: center;
  100. padding: 30upx;
  101. box-shadow: 0 10rpx 30rpx #ddd;
  102. .label {
  103. font-size: 14px;
  104. font-weight: 500;
  105. color: rgba(51, 51, 51, 1);
  106. line-height: 25px;
  107. text{
  108. background-color: #009FE8;
  109. color: #fff;
  110. padding: 4px;
  111. border-radius: 4px;
  112. margin-left: 10px;
  113. font-size: 12px;
  114. }
  115. }
  116. .inner {
  117. font-size: 14px;
  118. font-weight: 400;
  119. color: rgba(102, 102, 102, 1);
  120. line-height: 20px;
  121. overflow: hidden;
  122. text-overflow: ellipsis;
  123. display: -webkit-box;
  124. flex-direction: column;
  125. margin-top: 10px;
  126. border: 1px solid #2ECC71;
  127. color: #2ECC71;
  128. padding: 10px;
  129. }
  130. }
  131. .info_item:active {
  132. background-color: #f4f4f4;
  133. }
  134. }
  135. }
  136. }
  137. // .steps {
  138. // display: flex;
  139. // flex-direction: column;
  140. // margin: 0 30upx;
  141. // .steps_item {
  142. // display: flex;
  143. // align-items:center ;
  144. // background-color: #fff;
  145. // margin-top: 10rpx;
  146. // .s_r {
  147. // display: flex;
  148. // flex-direction: column;
  149. // align-items: center;
  150. // height: 100%;
  151. // background-color: #f3f;
  152. // flex: 1;
  153. // view {
  154. // height: 100%;
  155. // display: flex;
  156. // flex: 1;
  157. // height: 100%;
  158. // width: 5upx;
  159. // }
  160. // text {
  161. // display: flex;
  162. // flex-direction: column;
  163. // align-items: center;
  164. // width: 40upx;
  165. // line-height: 40upx;
  166. // height: 40upx;
  167. // border-radius: 50%;
  168. // background-color: #ff3838;
  169. // color: #ffffff;
  170. // font-size: 10px;
  171. // }
  172. // }
  173. // }
  174. // }
  175. // .info_list {
  176. // display: flex;
  177. // flex-direction: column;
  178. // flex: 1;
  179. // .info_item {
  180. // background-color: #fff;
  181. // height: 200upx;
  182. // margin: 20upx 0;
  183. // margin-right: 30upx;
  184. // border-radius: 10upx;
  185. // display: flex;
  186. // flex-direction: column;
  187. // justify-content: center;
  188. // padding: 0 30upx;
  189. // text {
  190. // font-size: 18px;
  191. // font-family: PingFangSC-Medium, PingFang SC;
  192. // font-weight: 500;
  193. // color: rgba(51, 51, 51, 1);
  194. // line-height: 25px;
  195. // }
  196. // view {
  197. // font-size: 14px;
  198. // font-family: PingFangSC-Regular, PingFang SC;
  199. // font-weight: 400;
  200. // color: rgba(102, 102, 102, 1);
  201. // line-height: 20px;
  202. // overflow: hidden;
  203. // text-overflow: ellipsis;
  204. // display: -webkit-box;
  205. // -webkit-line-clamp: 2;
  206. // flex-direction: column;
  207. // }
  208. // }
  209. // .info_item:active {
  210. // opacity: 0.6;
  211. // }
  212. // }
  213. </style>