index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class='item-con'>
  3. <div class="item-item" :style="{paddingLeft:(split-260)+ 'px'}" v-for="(item,i) in data" :key="i">
  4. <div class="item">
  5. <div class="type">
  6. <vcenter>
  7. {{item.type}}
  8. </vcenter>
  9. </div>
  10. <div class="title">
  11. <img :src="require('@/assets/images/index_img_news_03.jpg')" alt="">
  12. <div class="title-txt">
  13. <vcenter>
  14. <div>{{item.title}}</div>
  15. <div class="sub">{{item.username}}</div>
  16. </vcenter>
  17. </div>
  18. </div>
  19. <div class="date">
  20. <vcenter>
  21. <div>{{item.date}}</div>
  22. </vcenter>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  30. // 例如:import 《组件名称》 from '《组件路径》';
  31. import vcenter from '@/components/vcenter'
  32. export default {
  33. // import引入的组件需要注入到对象中才能使用
  34. props: {
  35. data: {
  36. default: () => {
  37. return []
  38. },
  39. type: Array
  40. },
  41. split: {
  42. default: 0,
  43. type: Number
  44. }
  45. },
  46. components: {vcenter},
  47. data () {
  48. // 这里存放数据
  49. return {
  50. }
  51. },
  52. // 监听属性 类似于data概念
  53. computed: {},
  54. // 监控data中的数据变化
  55. watch: {},
  56. // 方法集合
  57. methods: {
  58. },
  59. // 生命周期 - 创建完成(可以访问当前this实例)
  60. created () {
  61. },
  62. // 生命周期 - 挂载完成(可以访问DOM元素)
  63. mounted () {
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. $lHeight: 120px;
  69. .item-con {
  70. .item-item {
  71. background-color: #fff;
  72. border-bottom: 1px solid #e5e5e5;
  73. &:hover{
  74. background-color: #f6f6f6;
  75. }
  76. .item{
  77. max-width: 1200px;
  78. height: $lHeight;
  79. font-size: 0;
  80. position: relative;
  81. .type{
  82. display: inline-block;
  83. width: 260px;
  84. height: $lHeight;
  85. padding-left: 70px;
  86. color: #f9082a;
  87. font-size: 18px;
  88. }
  89. .title{
  90. display: inline-block;
  91. font-size: 18px;
  92. height: $lHeight;
  93. img{
  94. width: 186px;
  95. height: 121px;
  96. display: inline-block;
  97. font-size: 0;
  98. }
  99. .title-txt{
  100. display: inline-block;
  101. height: $lHeight;
  102. line-height: 1;
  103. padding: 40px 0;
  104. padding-left: 45px;
  105. .sub{
  106. color: #414141;
  107. font-size: 14px;
  108. margin-top: 8px;
  109. }
  110. }
  111. }
  112. .date{
  113. display: inline-block;
  114. font-size: 18px;
  115. height: $lHeight;
  116. position: absolute;
  117. right: 0;
  118. }
  119. }
  120. }
  121. }
  122. </style>