uniapp视频首页页面

<style scoped>

/* 全局样式 */

.container {

display: flex;

flex-direction: column;

height: 100vh;

}

/* 搜索栏样式 */

.search-bar {

display: flex;

align-items: center;

padding: 10px;

background-color: #fff;

box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

}

.logo {

width: 40px;

height: 40px;

margin-right: 10px;

}

.search-input {

flex: 1;

padding: 10px;

border: 1px solid #ddd;

border-radius: 5px;

}

.search-button {

padding: 10px 20px;

margin-left: 10px;

background-color: #ff4081;

color: #fff;

border: none;

border-radius: 5px;

}

/* 导航栏样式 */

.nav-bar {

display: flex;

justify-content: space-around;

padding: 10px 0;

background-color: #fff;

border-bottom: 1px solid #ddd;

}

.nav-item {

flex: 1;

text-align: center;

font-size: 16px;

color: #333;

padding: 10px;

}

.nav-item.active {

color: #ff4081;

border-bottom: 2px solid #ff4081;

}

/* 内容区域样式 */

.content-area {

flex: 1;

background-color: #f5f5f5;

}

.content-grid {

display: flex;

flex-wrap: wrap;

padding: 10px;

}

.content-item {

width: 48%;

margin: 1%;

background-color: #fff;

border-radius: 5px;

overflow: hidden;

box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

}

.content-item-image {

width: 100%;

height: 150px; /* 固定高度,确保方形显示 */

}

.content-item-title {

padding: 10px;

font-size: 14px;

color: #333;

white-space: nowrap;

overflow: hidden;

text-overflow: ellipsis;

}

</style>

<template>

<view class="container">

<!-- 搜索栏 -->

<view class="search-bar">

<image class="logo" src="/static/images/logo.png" mode="widthFix"></image>

<input class="search-input" placeholder="搜索视频"/>

<button class="search-button">搜索</button>

</view>

<!-- 导航栏 -->

<view class="nav-bar">

<view :class="'nav-item', {'active': activeTab === 'recommend'}" @click="changeTab('recommend')">推荐</view>

<view :class="'nav-item', {'active': activeTab === 'hot'}" @click="changeTab('hot')">热门</view>

<view :class="'nav-item', {'active': activeTab === 'article'}" @click="changeTab('article')">图文</view>

<view :class="'nav-item', {'active': activeTab === 'short'}" @click="changeTab('short')">短视频</view>

</view>

<!-- 内容区域 -->

<scroll-view class="content-area" :style="{height: contentHeight + 'px'}" scroll-y>

<view class="content-grid">

<navigator v-for="(item, index) in items" :key="index" :url="'/pages/videoDetail/main?id=' + item.id" hover-class="navigator-hover" class="content-item">

<image :src="item.image" mode="aspectFill" class="content-item-image"></image>

<text class="content-item-title">{{ item.title }}</text>

</navigator>

</view>

</scroll-view>

<!-- 底部导航栏(uniapp自带) -->

<uni-tabbar></uni-tabbar>

</view>

</template>

<script>

export default {

data() {

return {

activeTab: 'recommend',

items: [

{ id: 1, image: '/static/images/video1.jpg', title: '视频标题1' },

{ id: 2, image: '/static/images/video2.jpg', title: '视频标题2' },

{ id: 3, image: '/static/images/video3.jpg', title: '视频标题3' },

// 添加更多内容项

],

screenHeight: 0,

searchBarHeight: 60, // 搜索栏高度(可根据实际情况调整)

navBarHeight: 40, // 导航栏高度(可根据实际情况调整)

tabBarHeight: 50, // 底部导航栏高度(可根据实际情况调整)

};

},

computed: {

contentHeight() {

return this.screenHeight - this.searchBarHeight - this.navBarHeight - this.tabBarHeight;

}

},

onReady() {

// 获取屏幕高度

const systemInfo = uni.getSystemInfoSync();

this.screenHeight = systemInfo.windowHeight;

},

methods: {

changeTab(tab) {

this.activeTab = tab;

// 根据选中的标签加载相应的内容

// 这里可以调用API获取数据

}

}

};

</script>

相关推荐
美狐美颜SDK开放平台15 小时前
开发直播APP时如何接入视频美颜SDK?开发流程与注意事项
android·人工智能·计算机视觉·音视频·直播美颜sdk
2601_9556624618 小时前
短剧多人对白怎么配?2026年多角色配音工具对比
大数据·人工智能·音视频·语音识别
开发笔记-阿牛19 小时前
蓝牙音乐灯拆解,又一次拆到蓝牙音乐灯芯片CK6865L
人工智能·单片机·嵌入式硬件·音视频·音频
旺仔小馒头wang20 小时前
AI 智能手机发布会:赋予人类的五种新能力
人工智能·学习·音视频
纳祥科技20 小时前
拆机拆到芯片级:ARC功放机里的NX7026、NX8420、NX6805
单片机·音视频·智能音箱
youandyouyou21 小时前
律所内部培训共享的内网部署方案:架构、参数与三步落地
音视频
爱吃提升1 天前
文生视频核心
人工智能·音视频
2601_955662461 天前
抖音视频怎么做多语言配音?2026年AI配音工具与制作流程详解
人工智能·音视频·语音识别·视频
音视频牛哥1 天前
Android与HarmonyOS NEXT如何接入GB28181:从SIP到PS/RTP的完整链路
音视频·gb28181-2022对接·鸿蒙next gb28181·gb/t 28181-2022·gb/t 28181-2016·gb28181-2022平台
美狐美颜SDK开放平台1 天前
直播APP源码与视频美颜sdk如何配合?一套完整开发思路
android·人工智能·计算机视觉·音视频·直播美颜sdk