permanent.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="temporary">
  3. <ui-search v-model="searchKey" :placeholder="'请输入展览名称6'"></ui-search>
  4. <div class="searNone">
  5. <img src="../../" alt="">
  6. </div>
  7. <ul v-infinite-scroll="getData" infinite-scroll-disabled="busy" :infinite-scroll-immediate-check="true"
  8. infinite-scroll-distance="30" :key="ran">
  9. <li v-for="(item,i) in list" :key="i">
  10. <exItem :exData="item" />
  11. </li>
  12. </ul>
  13. </div>
  14. </template>
  15. <script setup>
  16. import { defineEmits, onMounted, watch, nextTick, ref } from "vue";
  17. import exItem from "@/components/exItem";
  18. import { getExhibitionList } from "@/config/api";
  19. const searchKey = ref("");
  20. const busy = ref(false)
  21. const list = ref([]);
  22. let paging = ref({
  23. pageSize: 10,
  24. pageNum: 1,
  25. current: 1,
  26. });
  27. watch(searchKey, () => {
  28. getData(true)
  29. });
  30. const getData = (reset = null) => {
  31. if (reset) {
  32. list.value = []
  33. busy.value = false
  34. }
  35. if (busy.value) {
  36. return
  37. }
  38. getExhibitionList({
  39. "pageNum": paging.value.pageNum,
  40. "pageSize": paging.value.pageSize,
  41. "museumId": 1,
  42. "searchKey": searchKey.value,
  43. "type": "long"
  44. }, data => {
  45. if (data.data.total <= list.value.length) {
  46. busy.value = true
  47. return
  48. }
  49. list.value = list.value.concat(data.data.records)
  50. paging.value.pageNum += 1
  51. })
  52. }
  53. onMounted(() => {
  54. getData()
  55. })
  56. </script>
  57. <style lang="scss" scoped>
  58. .temporary {
  59. width: 1400px;
  60. margin: 62px auto;
  61. .slebar {
  62. display: flex;
  63. >div {
  64. margin-left: 20px;
  65. }
  66. }
  67. >ul {
  68. width: 100%;
  69. >li {
  70. width: 100%;
  71. position: relative;
  72. &::after {
  73. content: "";
  74. display: inline-block;
  75. background: #d9c791;
  76. height: 1px;
  77. width: 110%;
  78. position: absolute;
  79. bottom: 0;
  80. left: 50%;
  81. transform: translateX(-50%);
  82. }
  83. }
  84. }
  85. }
  86. </style>