fix: 修复H5环境下关闭再打开日历的bug

This commit is contained in:
傅光孟 2026-02-09 17:00:23 +08:00
parent 37dee18a22
commit 71062c8e13
2 changed files with 32 additions and 17 deletions

View File

@ -32,7 +32,12 @@
<!-- 24小时榜 end --> <!-- 24小时榜 end -->
<view v-if="!loading" :class="['page-main ', { mask: !userStore.isLogin }]"> <view v-if="!loading" :class="['page-main ', { mask: !userStore.isLogin }]">
<view class="news-list-top"> <view class="news-list-top">
<view class="news-item" v-for="(item, index) in newsListTop" :key="item.news_id" @click="goDetail(item)"> <view
class="news-item"
v-for="(item, index) in newsListTop"
:key="item.news_id"
@click="goDetail(item)"
>
<view class="news-no"> {{ index + 1 }} </view> <view class="news-no"> {{ index + 1 }} </view>
<view class="news-info"> <view class="news-info">
<view class="news-title"> <view class="news-title">
@ -53,7 +58,12 @@
</view> </view>
<view class="news-list"> <view class="news-list">
<view class="news-item" v-for="(item, index) in newsList" :key="item.news_id" @click="goDetail(item)"> <view
class="news-item"
v-for="(item, index) in newsList"
:key="item.news_id"
@click="goDetail(item)"
>
<view class="news-no"> {{ index + 1 + topNum }} </view> <view class="news-no"> {{ index + 1 + topNum }} </view>
<view class="news-title"> <view class="news-title">
{{ item.title }} {{ item.title }}
@ -89,16 +99,19 @@
></u-loading-icon> ></u-loading-icon>
<!-- 日历 --> <!-- 日历 -->
<u-calendar <view v-if="calendarShow">
:show="calendarShow" <u-calendar
:min-date="calendar.minDate" :show="true"
:max-date="calendar.maxDate" :min-date="calendar.minDate"
:monthNum="calendar.monthNum" :max-date="calendar.maxDate"
:default-date="chooseDate.startDate" :monthNum="calendar.monthNum"
@confirm="calendarConfirm" :default-date="chooseDate.startDate"
@close="hideCalendar" closeOnClickOverlay
> @confirm="calendarConfirm"
</u-calendar> @close="hideCalendar"
>
</u-calendar>
</view>
<!-- 登录弹窗 start --> <!-- 登录弹窗 start -->
<LoginDialog <LoginDialog
@ -119,7 +132,7 @@ import { useUserStore } from "@/stores/user";
import RadarChat from "@/components/charts/Radar.vue"; import RadarChat from "@/components/charts/Radar.vue";
import LoginDialog from "@/components/loginPopup/index.vue"; import LoginDialog from "@/components/loginPopup/index.vue";
const userStore = useUserStore();// const userStore = useUserStore(); //
const LoginShow = ref(false); const LoginShow = ref(false);
// //
@ -196,7 +209,7 @@ const chooseDate = reactive({
// //
const calendarShow = ref(false); const calendarShow = ref(false);
function showCalendar() { function showCalendar() {
if(!userStore.isLogin || !userStore.isUserType) return; if (!userStore.isLogin || !userStore.isUserType) return;
calendarShow.value = true; calendarShow.value = true;
} }
// //
@ -212,7 +225,7 @@ function calendarConfirm(dateList: string[]) {
getNewsList(); getNewsList();
calendarShow.value = false; calendarShow.value = false;
isExpAll.value = false; isExpAll.value = false;
lastNewsIndex.value = 10 lastNewsIndex.value = 10;
} }
async function getNewsList() { async function getNewsList() {
@ -234,13 +247,13 @@ async function getNewsList() {
} }
// //
function goDetail(item:any) { function goDetail(item: any) {
if (userStore.isLogin) { if (userStore.isLogin) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/detail/indexNewsInfo?id=${item.news_id}`, url: `/pages/detail/indexNewsInfo?id=${item.news_id}`,
}); });
} else { } else {
handleShowLogin() handleShowLogin();
} }
} }

View File

@ -225,11 +225,13 @@ export default {
}, },
close() { close() {
this.$emit('close') this.$emit('close')
// this.scrollIntoView = ''; // bugH5bug
}, },
// //
confirm() { confirm() {
if (!this.buttonDisabled) { if (!this.buttonDisabled) {
this.$emit('confirm', this.selected) this.$emit('confirm', this.selected)
// this.scrollIntoView = ''; // bugH5bug
} }
}, },
// //