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

View File

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