首页标签特效

This commit is contained in:
zpc 2025-07-25 03:11:54 +08:00
parent 87c6fe7112
commit 9d9aa3d006
5 changed files with 23 additions and 22 deletions

1
components.d.ts vendored
View File

@ -17,7 +17,6 @@ declare module 'vue' {
RouterView: typeof import('vue-router')['RouterView']
Search: typeof import('./components/guyu/home/search.vue')['default']
SlideLabel: typeof import('./components/guyu/page/slide-label.vue')['default']
SlideLable: typeof import('./components/guyu/page/slide-lable.vue')['default']
Swiper: typeof import('./components/guyu/home/swiper.vue')['default']
Tabs: typeof import('./components/guyu/home/tabs.vue')['default']
}

View File

@ -2,10 +2,9 @@
<view class="tabs-container">
<view class="tabs-wrapper">
<template v-for="(item, index) in slideLableList" :key="index">
<view class="tab-item-wrapper" :style="{ width: item.width }">
<SlideLabel ref="slideLabels"
style="width: 100%;height:40rpx;border-radius: 50rpx;border: 1rpx solid #9A8F79;"
:defaultColor="item.active ? '#F5D677' : '#fff'" @click="clickTab(index)">
<view class="tab-item-wrapper" @click="clickTab(index)"
:style="{ width: item.width }">
<SlideLabel ref="slideLabels" :defaultColor="item.active ? '#F5D677' : '#fff'">
<text class="tab-text myZt-500w">{{ item.name }}</text>
</SlideLabel>
</view>

View File

@ -34,12 +34,12 @@ const props = defineProps({
//
height: {
type: [Number, String],
default: '80rpx'
default: '45rpx'
},
//
borderRadius: {
type: [Number, String],
default: '8rpx'
default: '25rpx'
},
//
textColor: {
@ -169,6 +169,7 @@ defineExpose({
position: relative;
width: 100%;
overflow: hidden;
border: 1rpx solid #9A8F79;
}
.color-bg {

View File

@ -19,7 +19,7 @@
</view>
<swiper class="swiper" :style="[{ height: swiperHeight + 'px' }]" :current="current"
@transition="swiperTransition" @animationfinish="swiperAnimationfinish">
<swiper-item class="swiper-item" v-for="(item, index) in tabList" :key="index">
<swiper-item class="swiper-item" v-for="(item, index) in homeData?.categories" :key="index">
<guyu-home-goods-list ref="swiperList" :tabIndex="index" :currentIndex="current"
@heightChanged="heightChanged">
</guyu-home-goods-list>

View File

@ -140,9 +140,11 @@ function getSystemInfoSync(useCache = false) {
const infoTypes = ['DeviceInfo', 'AppBaseInfo', 'WindowInfo'];
const { deviceInfo, appBaseInfo, windowInfo } = infoTypes.reduce((acc, key) => {
const method = `get${key}`;
try{
if (uni[method] && uni.canIUse(method)) {
acc[key.charAt(0).toLowerCase() + key.slice(1)] = uni[method]();
}
}catch{}
return acc;
}, {});
// 如果deviceInfo、appBaseInfo和windowInfo都可以从各自专属的api中获取则整合它们的数据