tui-list-view.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="tui-list-view tui-view-class" :style="{backgroundColor:backgroundColor,marginTop:marginTop}">
  3. <view class="tui-list-title" :style="{color:color,fontSize:size+'rpx',lineHeight:30+'rpx'}" v-if="title">{{title}}</view>
  4. <view class="tui-list-content" :class="[unlined?'tui-border-'+unlined:'']">
  5. <slot></slot>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name: "tuiListView",
  12. props: {
  13. title: {
  14. type: String,
  15. default: ''
  16. },
  17. color:{
  18. type: String,
  19. default: '#666'
  20. },
  21. //rpx
  22. size:{
  23. type:Number,
  24. default:30
  25. },
  26. backgroundColor:{
  27. type: String,
  28. default: 'transparent'
  29. },
  30. unlined: {
  31. type: String,
  32. default: '' //top,bottom,all
  33. },
  34. marginTop:{
  35. type:String,
  36. default:'0'
  37. }
  38. }
  39. }
  40. </script>
  41. <style scoped>
  42. .tui-list-title {
  43. width: 100%;
  44. padding: 30rpx;
  45. box-sizing: border-box;
  46. }
  47. .tui-list-content {
  48. width: 100%;
  49. position: relative;
  50. }
  51. .tui-list-content::before {
  52. content: " ";
  53. position: absolute;
  54. top: 0;
  55. right: 0;
  56. left: 0;
  57. border-top: 1px solid #eaeef1;
  58. -webkit-transform: scaleY(0.5) translateZ(0);
  59. transform: scaleY(0.5) translateZ(0);
  60. transform-origin: 0 0;
  61. z-index: 2;
  62. pointer-events: none;
  63. }
  64. .tui-list-content::after {
  65. content: '';
  66. width: 100%;
  67. position: absolute;
  68. border-bottom: 1px solid #eaeef1;
  69. -webkit-transform: scaleY(0.5) translateZ(0);
  70. transform: scaleY(0.5) translateZ(0);
  71. transform-origin: 0 100%;
  72. bottom: 0;
  73. right: 0;
  74. left: 0;
  75. }
  76. .tui-border-top::before {
  77. border-top: 0;
  78. }
  79. .tui-border-bottom::after {
  80. border-bottom: 0;
  81. }
  82. .tui-border-all::after {
  83. border-bottom: 0;
  84. }
  85. .tui-border-all::before {
  86. border-top: 0;
  87. }
  88. </style>