Mytextbook.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <!-- 我的教材 -->
  3. <div class="Mytextbook">
  4. <div class="bookList">
  5. <div v-for="(item, i) in bookList" :key="i">
  6. <img
  7. :src="
  8. require('../../assets/Personalcenter/image/img' +
  9. `${i + 1}` +
  10. '.png')
  11. "
  12. alt=""
  13. />
  14. <p>{{ item.name }}</p>
  15. </div>
  16. </div>
  17. <div class="paging">
  18. <el-pagination
  19. layout="prev, pager, next"
  20. :current-page="currentPage"
  21. :total="1000"
  22. :page-size="10"
  23. @current-change="changecurrentPage"
  24. />
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  30. //例如:import 《组件名称》from ‘《组件路径》';
  31. export default {
  32. //import引入的组件需要注入到对象中才能使用
  33. components: {},
  34. props: {},
  35. data() {
  36. //这里存放数据
  37. return {
  38. bookList: [
  39. {
  40. name: "Learn Chinese with Ease-Learn Chinese with ",
  41. },
  42. {
  43. name: "Learn Chinese",
  44. },
  45. {
  46. name: "Learn Chinese with Ease-Learn Chinese with ",
  47. },
  48. {
  49. name: "Learn Chinese ",
  50. },
  51. {
  52. name: "Learn Chinese with Ease-Learn Chinese with ",
  53. },
  54. {
  55. name: "Learn Chinese with Ease-Learn Chinese with ",
  56. },
  57. {
  58. name: "Learn Chinese",
  59. },
  60. ],
  61. currentPage: 1,
  62. };
  63. },
  64. //计算属性 类似于data概念
  65. computed: {},
  66. //监控data中数据变化
  67. watch: {},
  68. //方法集合
  69. methods: {
  70. // 修改当前页
  71. changecurrentPage(val) {
  72. this.currentPage = val;
  73. },
  74. },
  75. //生命周期 - 创建完成(可以访问当前this实例)
  76. created() {},
  77. //生命周期 - 挂载完成(可以访问DOM元素)
  78. mounted() {},
  79. //生命周期-创建之前
  80. beforeCreated() {},
  81. //生命周期-挂载之前
  82. beforeMount() {},
  83. //生命周期-更新之前
  84. beforUpdate() {},
  85. //生命周期-更新之后
  86. updated() {},
  87. //生命周期-销毁之前
  88. beforeDestory() {},
  89. //生命周期-销毁完成
  90. destoryed() {},
  91. //如果页面有keep-alive缓存功能,这个函数会触发
  92. activated() {},
  93. };
  94. </script>
  95. <style lang="scss" scoped>
  96. /* @import url(); 引入css类 */
  97. .Mytextbook {
  98. .bookList {
  99. display: flex;
  100. flex-wrap: wrap;
  101. > div {
  102. width: 144px;
  103. margin: 40px 0 0 40px;
  104. img {
  105. width: 100%;
  106. height: 192px;
  107. cursor: pointer;
  108. }
  109. > p {
  110. word-break: break-all;
  111. display: -webkit-box;
  112. -webkit-box-orient: vertical;
  113. -webkit-line-clamp: 2;
  114. text-overflow: ellipsis;
  115. overflow: hidden;
  116. }
  117. }
  118. }
  119. .paging {
  120. margin-top: 20px;
  121. margin-left: 25px;
  122. }
  123. }
  124. </style>