app/pages/tabbar/home/index.vue

84 lines
1.6 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
<!-- 楼层装修组件 -->
<u-navbar class="navbar" :is-back="false" :is-fixed="false">
<div class="tab-container">
<div
v-for="(item, index) in list1"
:key="index"
:class="{ active: currentTabIndex === index }"
@click="click(item)"
>
{{ item.name }}
</div>
</div>
</u-navbar>
<!-- 商城 -->
<tpl ref="tpl" v-if="currentTabIndex == 1" :ste="1" />
<!-- 本地生活 -->
<tpl ref="tpl" 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";
export default {
data() {
return {
background: {
backgroundColor: "#fff",
},
2025-03-28 16:05:11 +08:00
list1: [
{
name: "本地生活",
},
{
name: "商城",
},
],
currentTabIndex: 0,
2025-03-14 16:27:50 +08:00
};
},
2025-03-24 10:53:42 +08:00
components: {
tpl,
},
2025-03-28 16:05:11 +08:00
methods: {
click(item) {
this.currentTabIndex = this.list1.indexOf(item);
},
},
2025-03-14 16:27:50 +08:00
onPullDownRefresh() {
this.$refs.tpl.init();
uni.stopPullDownRefresh();
},
};
</script>
<style lang="scss" scoped>
2025-03-28 16:05:11 +08:00
.tab-container {
width: 100%;
display: flex;
justify-content: space-evenly;
// background-color: #f0f0f0;
// padding: 0 16rpx 0 0;
font-size: 18px;
}
.tab-container div {
cursor: pointer;
padding: 5px 10px;
}
.tab-container div.active {
border-bottom: 2px solid #F50505;
color:#F50505;
background-color: transparent;
}
.wrapper {
// background: red;
}
.navbar{
height: 100%;
2025-03-19 15:35:09 +08:00
}
2025-03-24 10:53:42 +08:00
2025-03-14 16:27:50 +08:00
</style>