吉光研途前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
1.7 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="card">
  3. <view v-if="!isFold" class="content">
  4. <view class="list">
  5. <view class="list-item" v-for="item in list" :key="item.id">
  6. <serveSecondModuleCard :data="item"></serveSecondModuleCard>
  7. </view>
  8. </view>
  9. </view>
  10. <serveModuleView :style="style" v-model="isFold" :data="data" @change="onChange"></serveModuleView>
  11. </view>
  12. </template>
  13. <script>
  14. import serveModuleView from './serveModuleView.vue';
  15. import serveSecondModuleCard from './serveSecondModuleCard.vue';
  16. export default {
  17. components: {
  18. serveModuleView,
  19. serveSecondModuleCard,
  20. },
  21. props: {
  22. data: {
  23. type: Object,
  24. default() {
  25. return {}
  26. }
  27. }
  28. },
  29. data() {
  30. return {
  31. isFold: true,
  32. list: [],
  33. }
  34. },
  35. computed: {
  36. style() {
  37. return this.isFold ? '' : 'position: absolute; top: 0; left: 0; width: 100%;'
  38. }
  39. },
  40. methods: {
  41. async getData() {
  42. try {
  43. this.list = (await this.$fetch('queryCategoryServiceModuleList', { pid: this.data.id, pageNo: 1, pageSize: 1000 }))?.records
  44. } catch (err) {
  45. }
  46. },
  47. onChange(isFold) {
  48. console.log('onChange', isFold)
  49. if (isFold) {
  50. return
  51. }
  52. if (this.list.length) {
  53. return
  54. }
  55. this.getData()
  56. },
  57. },
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .card,
  62. .content {
  63. width: 100%;
  64. position: relative;
  65. }
  66. .absolute {
  67. position: absolute;
  68. top: 0;
  69. left: 0;
  70. }
  71. .list {
  72. padding: 90rpx 20rpx 0 12rpx;
  73. box-sizing: border-box;
  74. &-item {
  75. & + & {
  76. margin-top: 26rpx;
  77. }
  78. }
  79. }
  80. </style>