|
|
- <template>
- <view class="card">
- <view v-if="!isFold" class="content">
- <view class="list">
- <view class="list-item" v-for="item in list" :key="item.id">
- <serveSecondModuleCard :data="item"></serveSecondModuleCard>
- </view>
- </view>
- </view>
- <serveModuleView :style="style" v-model="isFold" :data="data" @change="onChange"></serveModuleView>
- </view>
- </template>
-
- <script>
- import serveModuleView from './serveModuleView.vue';
- import serveSecondModuleCard from './serveSecondModuleCard.vue';
-
- export default {
- components: {
- serveModuleView,
- serveSecondModuleCard,
- },
- props: {
- data: {
- type: Object,
- default() {
- return {}
- }
- }
- },
- data() {
- return {
- isFold: true,
- list: [],
- }
- },
- computed: {
- style() {
- return this.isFold ? '' : 'position: absolute; top: 0; left: 0; width: 100%;'
- }
- },
- methods: {
- async getData() {
- try {
- this.list = (await this.$fetch('queryCategoryServiceModuleList', { pid: this.data.id, pageNo: 1, pageSize: 1000 }))?.records
- } catch (err) {
-
- }
- },
- onChange(isFold) {
- console.log('onChange', isFold)
-
- if (isFold) {
- return
- }
-
- if (this.list.length) {
- return
- }
-
- this.getData()
- },
- },
- }
- </script>
-
- <style scoped lang="scss">
-
- .card,
- .content {
- width: 100%;
- position: relative;
- }
-
- .absolute {
- position: absolute;
- top: 0;
- left: 0;
- }
-
- .list {
- padding: 90rpx 20rpx 0 12rpx;
- box-sizing: border-box;
-
- &-item {
- & + & {
- margin-top: 26rpx;
- }
- }
- }
- </style>
|