index.vue
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-19 11:19:03
* @FilePath: /meihuaApp/src/pages/book/index.vue
* @Description: 文件描述
-->
<template>
<view class="book-page">
<view id="book-content" class="book-content">
<view id="book-cal" class="book-cal">
<calendar-select @on-dates-change="onDatesChange"></calendar-select>
</view>
<view class="book-type">
<nut-tabs v-model="value" title-scroll title-gutter="10" name="tabName" background="#FFF" color="#4C2E08" animated-time="0">
<nut-tab-pane v-for="item in list" :title="'Tab ' + item" :pane-key="item">
<view v-if="showContent" class="book-list">
<scroll-view ref="refScrollView" :style="scrollStyle" :scroll-y="true" :scroll-with-animation="true" @scrolltolower="onScrollToLower">
<view v-for="(item, index) in 10" :key="index">
<room-card :key="index"></room-card>
<view v-if="index === 9" style="height: 2rem;"></view>
</view>
</scroll-view>
</view>
</nut-tab-pane>
</nut-tabs>
</view>
</view>
<nav-bar activated="book" />
</view>
</template>
<script setup>
import Taro from '@tarojs/taro'
import { ref } from "vue";
import navBar from '@/components/navBar.vue'
import calendarSelect from '@/components/calendarSelect.vue'
import roomCard from '@/components/roomCard.vue'
const onDatesChange = ({ startDate, endDate }) => {
console.warn(startDate, endDate);
}
const value = ref('0');
const list = new Array(5).fill(0).map((_, index) => index);
</script>
<script>
import "./index.less";
import { $ } from '@tarojs/extend'
export default {
name: "bookPage",
computed: {
scrollStyle() {
return {
refScrollView: null,
height: this.indexCoverHeight + 'px',
// paddingBottom: 50 + 'px',
};
},
},
mounted () {
Taro.showLoading({
title: '加载中',
});
// 设置首页封面高度
const windowHeight = wx.getSystemInfoSync().windowHeight;
// 处理切换显示白屏问题
setTimeout(() => {
this.showContent = true;
}, 100);
// setTimeout(async () => {
// const navHeight = await $('#navbar-page').height();
// const calHeight = await $('#book-cal').height();
// this.indexCoverHeight = windowHeight - navHeight - calHeight - 50;
// }, 500);
this.$nextTick(async () => {
const navHeight = await $('#navbar-page').height();
const calHeight = await $('#book-cal').height();
this.indexCoverHeight = windowHeight - navHeight - calHeight - 50;
if (this.$refs.refScrollView) {
Taro.hideLoading();
console.warn('加载完成');
}
});
},
data() {
return {
showContent: false,
indexCoverHeight: 0,
};
},
methods: {
onScrollToLower () {
// if(!this.flag){
// return
// }
// this.flag = false;
// this.getList();
console.warn('onScrollToLower');
},
}
};
</script>