dl_uniapp/pages/index.vue
2025-04-02 11:34:12 +08:00

94 lines
2.1 KiB
Vue

<template>
<view class="content">
<!-- 主体区域 -->
<view class="content-body">
<!-- 通告列表页 -->
<notice-index v-show="'home'==menuCode"></notice-index>
<mine-index v-show="'my'==menuCode"></mine-index>
<subscribe v-show="'dingyue'==menuCode"></subscribe>
</view>
<tabBarVue :menuCode="menuCode" ref="tarBar" @changeMenu="changeMenu"></tabBarVue>
</view>
</template>
<script>
import tabBarVue from '@/components/tabbar/tabBar.vue'
import noticeIndex from '@/pages/components/notice-index.vue'
import subscribe from '@/pages/components/subscribe.vue'
import mineIndex from '@/pages/mine/mine-index.vue'
export default {
components: {
tabBarVue,
noticeIndex,
subscribe,
mineIndex
},
data() {
return {
menus: ['全部', '最新', '高奖励', '急招', '品牌置换'],
menuIndex: 0,
dataList: ['1', '2', '2', '2'],
queryParams: {
pageNo: 1,
pageSize: 10,
},
total: 0,
//下来刷新状态
isTriggered: false,
menuCode: "dingyue",
}
},
onLoad: function() {
},
methods: {
itemClick(index, item) {
this.menuIndex = index
},
/**
* 菜单切换
* @param {Object} code
*/
changeMenu(code) {
this.menuCode = code
},
/**
* 上滑加载数据
*/
onReachBottomCus() {
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total) {
uni.$u.toast('没有更多数据了')
return
}
//页码+1,调用获取数据的方法获取第二页数据
this.queryParams.pageNo++
},
/**
* 下拉刷新数据
*/
onRefresherrefresh() {
this.isTriggered = true
this.queryParams.pageNo = 1
this.total = 0
},
}
}
</script>
<style lang="scss">
.content {
width: 100%;
color: #363636;
background-color: #F6F6F6;
font-size: 38rpx;
height: 100vh;
}
.content-body {
width: 100%;
background-color: white;
padding-top: var(--status-bar-height);
padding-bottom: var(--window-bottom);
}
</style>