officialAccount/pages/index/index.vue

80 lines
1.6 KiB
Vue
Raw Normal View History

2025-05-26 08:59:24 +08:00
<template>
2025-05-26 16:48:12 +08:00
<view class="login-container">
2025-05-28 17:36:42 +08:00
<!-- 底部的栏为啥这样写是因为要做左右拉动 -->
<view class="botton-view">
<view v-for="(item,index) in itemArray" class="array-father">
<view :class="itemTarget===index ? `bottom-button-target` : `bottom-button`" @click="itemTarget=index">
<view class="">
{{item}}
</view>
2025-05-26 16:48:12 +08:00
</view>
2025-05-28 17:36:42 +08:00
<view v-show="itemTarget===index" class="blue-heng"></view>
2025-05-26 16:48:12 +08:00
</view>
</view>
2025-05-26 08:59:24 +08:00
</view>
</template>
<script setup>
2025-05-26 16:48:12 +08:00
import {
reactive,
ref
} from 'vue';
2025-05-28 17:36:42 +08:00
const itemArray = ["NU", "动态", "我的"];
const itemTarget = ref(0);
2025-05-26 08:59:24 +08:00
</script>
2025-05-26 16:48:12 +08:00
<style lang="scss" scoped>
.login-container {
display: flex;
flex-direction: column;
2025-05-28 17:36:42 +08:00
min-height: 100vh;
2025-05-26 16:48:12 +08:00
width: 100%;
background-color: rgb(239, 241, 252);
position: relative;
2025-05-28 17:36:42 +08:00
}
2025-05-26 16:48:12 +08:00
2025-05-28 17:36:42 +08:00
.array-father {
width: 33%;
position: relative;
}
2025-05-26 16:48:12 +08:00
2025-05-28 17:36:42 +08:00
.botton-view {
position: fixed;
bottom: 0;
left: 0;
height: 200rpx;
width: 100%;
// background-color: greenyellow;
display: flex;
justify-content: space-between;
font-weight: 500;
.bottom-button {
2025-05-26 16:48:12 +08:00
width: 100%;
2025-05-28 17:36:42 +08:00
height: 100%;
display: flex;
justify-content: center;
align-items: center;
2025-05-26 16:48:12 +08:00
}
2025-05-28 17:36:42 +08:00
.bottom-button-target {
2025-05-26 16:48:12 +08:00
width: 100%;
2025-05-28 17:36:42 +08:00
height: 100%;
2025-05-26 16:48:12 +08:00
display: flex;
2025-05-28 17:36:42 +08:00
justify-content: center;
2025-05-26 16:48:12 +08:00
align-items: center;
2025-05-28 17:36:42 +08:00
color: rgb(42, 133, 235);
2025-05-26 16:48:12 +08:00
}
2025-05-28 17:36:42 +08:00
.blue-heng {
height: 6rpx;
width: 150rpx;
background-color: rgb(42, 133, 235);
position: absolute;
bottom: 55rpx;
left: 50%;
/* 左边缘到父容器左边的距离占父宽度 50% */
transform: translateX(-50%);
2025-05-26 16:48:12 +08:00
}
}
2025-05-26 08:59:24 +08:00
</style>