item.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div id="item">
  3. <el-row type="flex" @click.native="toEdit" class="item">
  4. <el-col :span="9" class="i_row">
  5. <van-image :src="data.imgUrl" :width="imgpx" :height="imghpx" fit="scale-down">
  6. <template #error>
  7. <van-image :src="noImg" :width="imgpx" :height="imghpx" fit="scale-down" />
  8. </template>
  9. </van-image>
  10. </el-col>
  11. <el-col :span="15" class="s_row">
  12. <el-col :span="24" class="dl2">{{ data.title }}</el-col>
  13. <el-col :span="24" class="last__row">
  14. <el-col :span="18"> {{ data.create_time }} </el-col>
  15. <el-col :span="6">阅读: {{ data.read }} </el-col>
  16. </el-col>
  17. </el-col>
  18. </el-row>
  19. </div>
  20. </template>
  21. <script>
  22. import { mapState, createNamespacedHelpers } from 'vuex';
  23. export default {
  24. name: 'item',
  25. props: { data: { type: Object, default: () => {} } },
  26. components: {},
  27. data: function() {
  28. return {
  29. noImg: require('@a/noImg.jpg'),
  30. };
  31. },
  32. created() {},
  33. methods: {
  34. toEdit() {
  35. this.$router.push({ path: '/adminRefute/edit', query: { id: this.data._id } });
  36. },
  37. },
  38. computed: {
  39. ...mapState(['user', 'menuParams']),
  40. pageTitle() {
  41. return `${this.$route.meta.title}`;
  42. },
  43. imgpx() {
  44. return 120;
  45. },
  46. imghpx() {
  47. return this.imgpx * 0.8;
  48. },
  49. },
  50. metaInfo() {
  51. return { title: this.$route.meta.title };
  52. },
  53. };
  54. </script>
  55. <style lang="less" scoped>
  56. @subWord: #666666;
  57. .item {
  58. border-bottom: 1px solid #ccc;
  59. padding: 8px 0;
  60. .i_row {
  61. text-align: center;
  62. /deep/.van-image__img {
  63. border: 1px solid #f1f1f1;
  64. }
  65. }
  66. .s_row {
  67. padding: 0 0.3125rem;
  68. .dl2 {
  69. font-size: 16px;
  70. overflow: hidden;
  71. text-overflow: ellipsis;
  72. -webkit-line-clamp: 2;
  73. word-break: break-all;
  74. display: -webkit-box;
  75. -webkit-box-orient: vertical;
  76. }
  77. .last__row {
  78. font-size: 0.875rem;
  79. color: @subWord;
  80. position: absolute;
  81. bottom: 10px;
  82. width: 60%;
  83. }
  84. }
  85. }
  86. </style>