app/pages/tabbar/home/index.vue

105 lines
2.2 KiB
Vue
Raw Normal View History

2025-03-14 16:27:50 +08:00
<template>
<div class="wrapper">
2025-03-28 16:05:11 +08:00
<!-- 楼层装修组件 -->
2025-04-21 17:39:41 +08:00
<!-- <u-navbar class="navbar" :is-back="false" :is-fixed="false">
2025-03-28 16:05:11 +08:00
<div class="tab-container">
2025-04-21 17:39:41 +08:00
<div
v-for="(item, index) in list1"
:key="index"
:class="{ active: currentTabIndex === index }"
@click="click(item)"
>
{{ item.name }}
</div>
2025-03-28 16:05:11 +08:00
</div>
2025-04-21 17:39:41 +08:00
</u-navbar> -->
<!-- <u-tabs-swiper ref="tabs" :list="list" :is-scroll="true" current="0"></u-tabs-swiper> -->
<u-tabs
name="cate_name"
count="cate_count"
:list="list"
:is-scroll="false"
:current="current"
@change="change"
></u-tabs>
2025-03-28 16:05:11 +08:00
<!-- 商城 -->
<tpl ref="tpl" v-if="currentTabIndex == 1" :ste="1" />
<!-- 本地生活 -->
2025-04-22 10:01:19 +08:00
<tpl ref="childComp" v-if="currentTabIndex == 0" :ste="0" />
2025-03-14 16:27:50 +08:00
</div>
</template>
<script>
import tpl from "@/pages/tabbar/home/views.vue";
2025-04-21 17:39:41 +08:00
import Views from "./views.vue";
2025-03-14 16:27:50 +08:00
export default {
data() {
return {
2025-04-21 17:39:41 +08:00
list: [
{
name: "本地生活",
},
{
name: "商城",
},
],
current: 0,
2025-03-14 16:27:50 +08:00
background: {
backgroundColor: "#fff",
},
2025-03-28 16:05:11 +08:00
list1: [
{
name: "本地生活",
},
{
name: "商城",
},
],
currentTabIndex: 0,
2025-04-21 17:39:41 +08:00
current: 0, // tabs组件的current值表示当前活动的tab选项
swiperCurrent: 0, // swiper组件的current值表示当前那个swiper-item是活动的
2025-03-14 16:27:50 +08:00
};
},
2025-04-21 17:39:41 +08:00
2025-03-24 10:53:42 +08:00
components: {
tpl,
},
2025-04-21 17:39:41 +08:00
onReachBottom() {
console.log("触底了");
2025-04-22 10:01:19 +08:00
this.$refs.childComp.loadMon();
2025-04-21 17:39:41 +08:00
},
2025-03-28 16:05:11 +08:00
methods: {
2025-04-21 17:39:41 +08:00
change(index) {
this.current = index;
this.currentTabIndex = index;
2025-03-28 16:05:11 +08:00
},
},
2025-03-14 16:27:50 +08:00
};
</script>
<style lang="scss" scoped>
2025-03-28 16:05:11 +08:00
.tab-container div.active {
2025-04-21 17:39:41 +08:00
border-bottom: 2px solid #f50505;
color: #f50505;
2025-03-28 16:05:11 +08:00
background-color: transparent;
}
.wrapper {
// background: red;
}
2025-04-21 17:39:41 +08:00
.navbar {
2025-03-28 16:05:11 +08:00
height: 100%;
2025-03-19 15:35:09 +08:00
}
2025-04-21 17:39:41 +08:00
::v-deep {
.u-tabs {
padding: 25px 20px 0px 20px;
}
.u-tab-item {
color: $main-color !important;
}
.u-tab-bar {
background-color: $light-color !important;
}
}
2025-03-14 16:27:50 +08:00
</style>