tap click失效
<!-- eslint-disable vue/multi-word-component-names -->
<template>
<view>
<view class="content">
<TAbbar :user-type="userType" @change="swtichSwiper" />
<swiper
current="current"
duration="300"
class="scroll-view-height"
@change="swipeIndex"
>
<swiper-item>
<scroll-view scroll-y="true" class="list-content">
<view
v-for="(item, index) in list"
key="'进行中' + item.id"
class="list-item"
hover-class="list-itemHover"
@tap="navTo(item)"
>
<view class="list-item-huiyi">
<view class="list-item-huiyi-name">
会议名称:<text style="color: red">
{{ ${item.title} (${index + 1})
}}
</text>
</view>
</view>
<view class="list-item-meeting">
<view class="list-item-meeting-type">
会议类型: {{ item.type }}
</view>
<view class="list-item-meeting-type">
主持人: {{ item.name }}
</view>
<view class="list-item-meeting-type">
召开时间: {{ item.dataTime }}
</view>
<view class="list-item-meeting-type">
召开地点: {{ item.site }}
</view>
</view>
</view>
<view
v-if="list.length"
class="scroll-view-height-noCard"
hover-class="list-itemHover"
@tap="load(item)"
>
<text>加载更多</text>
</view>
<view v-if="!list.length" class="scroll-view-height-noCard">
<text>当前没有进行的会议</text>
</view>
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view scroll-y="true" class="list-content">
<view
v-for="(item, index) in list"
key="'进行中' + index"
class="list-item"
hover-class="list-itemHover"
@tap="navTo(item)"
>
<view class="list-item-huiyi">
<view class="list-item-huiyi-name">
会议名称:<text style="color: red">
{{ ${item.title} (${index + 1})
}}
</text>
</view>
</view>
<view class="list-item-meeting">
<view class="list-item-meeting-type">
会议类型: {{ item.type }}
</view>
<view class="list-item-meeting-type">
主持人: {{ item.name }}
</view>
<view class="list-item-meeting-type">
召开时间: {{ item.dataTime }}
</view>
<view class="list-item-meeting-type">
召开地点: {{ item.site }}
</view>
</view>
</view>
<view
v-if="list.length"
class="scroll-view-height-noCard"
hover-class="list-itemHover"
@tap="load(item)"
>
<text>加载更多</text>
</view>
<view v-if="!list.length" class="scroll-view-height-noCard">
<text>当前没有进行的会议</text>
</view>
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view scroll-y="true" class="list-content">
<view
v-for="(item, index) in list"
key="'进行中' + index"
class="list-item"
hover-class="list-itemHover"
@tap="navTo(item)"
>
<view class="list-item-huiyi">
<view class="list-item-huiyi-name">
会议名称:<text style="color: red">
{{ ${item.title} (${index + 1})
}}
</text>
</view>
</view>
<view class="list-item-meeting">
<view class="list-item-meeting-type">
会议类型: {{ item.type }}
</view>
<view class="list-item-meeting-type">
主持人: {{ item.name }}
</view>
<view class="list-item-meeting-type">
召开时间: {{ item.dataTime }}
</view>
<view class="list-item-meeting-type">
召开地点: {{ item.site }}
</view>
</view>
</view>
<view
v-if="list.length"
class="scroll-view-height-noCard"
hover-class="list-itemHover"
@tap="load(item)"
>
<text>加载更多</text>
</view>
<view v-if="!list.length" class="scroll-view-height-noCard">
<text>当前没有进行的会议</text>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
</view>
</template>
<script lang="ts" setup>
import { ref, getCurrentInstance, onBeforeMount } from 'vue'
import { onResize } from '@dcloudio/uni-app'
const { proxy } = getCurrentInstance() as any
const current = ref(0)
const userType = ref(0)
// eslint-disable-next-line no-unused-vars
const scrollerHeight = ref('')
// eslint-disable-next-line no-unused-vars
const scrollerWidth = ref('')
const list = ref([
{
title: '关于高新区清扫黄赌毒等一系列有关问题',
type: '常委会',
name: '刘德华',
dataTime: '2022-10-01 12:00',
site: '成都是高新区环球中心'
}
])
const swipeIndex = (index: Number) => {
proxy.userType = index.detail.current
}
const swtichSwiper = (index: any) => {
proxy.current = index
}
const navTo = (item: any) => {
uni.navigateTo({
url: /pages/details/details?item=${encodeURIComponent(JSON.stringify(item))}
})
}
const load = () => {
const listItem = {
title: '测试',
name: '测试',
type: '人大',
dataTime: '2022-12-12 12:00',
site: 'redaction'
}
uni.showLoading({
title: '加载中'
})
setTimeout(() => {
uni.hideLoading()
proxy.list.push(listItem)
}, 500)
}
onResize(() => {
uni.getSystemInfo({
// eslint-disable-next-line object-shorthand, func-names
success: function (res) {
// 获取屏幕的高度
proxy.scrollerHeight = ${res.windowHeight}px
// 获取屏幕的宽度
proxy.scrollerWidth = ${res.windowWidth}px
}
})
})
onBeforeMount(() => {
uni.getSystemInfo({
// eslint-disable-next-line object-shorthand, func-names
success: function (res) {
// 获取屏幕的高度
proxy.scrollerHeight = ${res.windowHeight}px
// 获取屏幕的宽度
proxy.scrollerWidth = ${res.windowWidth}px
}
})
})
</script>
<style lang="scss" scoped>
.content {
width: 100%;
height: 100vh;
background-color: $user-bg-color;
&-text-area {
display: flex;
justify-content: center;
}
}
.scroll-view-height {
overflow: auto;
width: 100%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
overflow-x: hidden;
overflow-y: scroll;
/ 页面高度减去包含状态栏、标题、tab组件的高度 /
height: calc(100vh - var(--status-bar-height) - 300rpx);
&-noCard {
width: 100%;
height: 10%;
margin: auto;
background-color: $user-bg-color;
display: flex;
align-items: center;
justify-content: center;
color: var(--van-black);
box-shadow: 0 0 10upx 0 rgba(0, 0, 0, 0.1);
border-radius: 10upx;
}
}
.list-content {
overflow-x: hidden;
overflow-y: scroll;
height: 100%;
width: 100%;
background-color: $user-bg-color;
}
.list-itemHover {
background-color: #eee;
}
.list-item {
height: 20%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
margin: 0.5% 0;
border-bottom: solid 5rpx $brimColor;
border-top: solid 5rpx $brimColor;
overflow: auto;
&-huiyi {
padding-top: 10rpx;
height: 40%;
width: 100%;
font-size: 1.2em;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
&-name {
height: 100%;
width: 80%;
}
}
&-meeting {
height: 100%;
width: 80%;
font-size: 1.2em;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
align-content: space-between;
flex-wrap: wrap;
&-type {
border-radius: 5px;
box-sizing: border-box;
width: calc(50% - 1rpx);
height: calc(50% - 1rpx);
float: left;
}
}
}
</style>
8***@qq.com
牛逼,我的问题确实是这个。
2023-08-11 08:41