uniapp小视频项目:消息列表开发

2024-05-12 08:48

本文主要是介绍uniapp小视频项目:消息列表开发,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

    • 1、创建消息页面
    • 2、完善消息页面

1、创建消息页面

首先创建 news 页面,然后在 pages.json 中设置为 tabbar 页面,然后给 tab 页面中增加跳转

pages.json

{......"tabBar": {"list": [......{"pagePath": "pages/news/news","text": "消息"}]}
}

修改 tab.vue

<navigator open-type="switchTab" url="/pages/news/news" class="tab-box">消息
</navigator>

新建消息头部页面 news-nav.vue,并引入 news 页面

<template><view class="newsNav"><view class="title">消息</view></view>
</template><script>export default {name:"newsNav",data() {return {};}}
</script><style>.newsNav{width: 100%;height: 80px;}.title{width: 100%;text-align: center;height: 80px;line-height: 80px;font-size: 20px;color: #ffffff;}
</style>

同时把 tab 引入页面

<template><view class="news"><news-nav></news-nav><tab></tab></view>
</template><script>import newsNav from '../../components/newsNav.vue'import tab from '../../components/tab'export default {components:{newsNav,tab},data() {return {}},methods: {}}
</script><style>
.news{width: 100%;height: 100%;background: #000000;
}
</style>

暂时的效果:
在这里插入图片描述

2、完善消息页面

修改 news.vue,引入新建组件 news-content

<template><view class="news"><news-nav></news-nav><news-content></news-content><tab></tab></view>
</template><script>import newsNav from '../../components/newsNav.vue'import tab from '../../components/tab'import newsContent from '../../components/newsContent.vue'export default {components:{newsNav,tab,newsContent},data() {return {}},methods: {}}
</script><style>
.news{width: 100%;height: 100%;background: #000000;
}
</style>

新建 newsContent.vue 组件

<template><view class="newsContent"><view class="box"><view class="icon" v-for="item in iconList" :key="item.id"><view class="img-box"><image class="img" :src="item.id"></image></view><view class="icon-text">{{item.text}}</view></view></view><view class="newsList"><view class="item" v-for="item in newsList" :key="item.id"><view class="author-img-box"><image class="author-img" src="../static/profile.webp"></image></view><view class="text"><view class="top"><view class="name">{{item.name}}</view><view class="time">{{item.time}}</view></view><view class="content">{{item.content}}</view></view></view><view class="more">没有更多消息</view></view></view>
</template><script>export default {name: "newsContent",data() {return {newsList:[{'id':1,'name':'张三','time':'周三','content':'很高兴和大家认识'},{'id':2,'name':'李四','time':'周四','content':'Nice 2 meet u'},{'id':3,'name':'王五','time':'周五','content':'戴好口罩,居家工作ing'},],iconList:[{'id':1,'src':'../static/fensi.png','text':'粉丝'},{'id':2,'src':'../static/dianzan.png','text':'点赞'},{'id':3,'src':'../static/pinglun.png','text':'评论'},{'id':4,'src':'../static/hudong.png','text':'随拍互动'}]};}}
</script><style>.newsContent {width: 100%;background: #000000;}.box {width: 100%;height: 120px;}.icon {width: 25%;height: 100px;float: left;margin: 0 auto;}.img-box {text-align: center;}.img {width: 40px;height: 40px;border-radius: 5px;margin-top: 20px;}.icon-text {font-size: 13px;text-align: center;color: #eeeeee;margin-top: 5px;}.newsList{background:#000000;}.item{height: 60px;padding: 15px 10px;}.author-img-box{float: left;margin-left: 10px;}.author-img{width: 45px;height: 45px;border-radius: 50%;}.text{float: left;margin-left: 10px;height: 50px;width: 75%;color: #ffffff;}.top{height: 25px;line-height: 25px;}.name{float: left;font-size: 18px;}.time{float: right;font-size: 11px;color: #aaaaaa;}.content{height: 25px;line-height: 25px;font-size: 13px;color: #aaaaaa;}.more{width: 100%;height: 50px;line-height: 50px;color: #aaaaaa;text-align: center;font-size: 12px;}
</style>

查看效果
在这里插入图片描述

源码下载

这篇关于uniapp小视频项目:消息列表开发的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/982153

相关文章

Python中将嵌套列表扁平化的多种实现方法

《Python中将嵌套列表扁平化的多种实现方法》在Python编程中,我们常常会遇到需要将嵌套列表(即列表中包含列表)转换为一个一维的扁平列表的需求,本文将给大家介绍了多种实现这一目标的方法,需要的朋... 目录python中将嵌套列表扁平化的方法技术背景实现步骤1. 使用嵌套列表推导式2. 使用itert

深度解析Java项目中包和包之间的联系

《深度解析Java项目中包和包之间的联系》文章浏览阅读850次,点赞13次,收藏8次。本文详细介绍了Java分层架构中的几个关键包:DTO、Controller、Service和Mapper。_jav... 目录前言一、各大包1.DTO1.1、DTO的核心用途1.2. DTO与实体类(Entity)的区别1

java向微信服务号发送消息的完整步骤实例

《java向微信服务号发送消息的完整步骤实例》:本文主要介绍java向微信服务号发送消息的相关资料,包括申请测试号获取appID/appsecret、关注公众号获取openID、配置消息模板及代码... 目录步骤1. 申请测试系统2. 公众号账号信息3. 关注测试号二维码4. 消息模板接口5. Java测试

如何在Spring Boot项目中集成MQTT协议

《如何在SpringBoot项目中集成MQTT协议》本文介绍在SpringBoot中集成MQTT的步骤,包括安装Broker、添加EclipsePaho依赖、配置连接参数、实现消息发布订阅、测试接口... 目录1. 准备工作2. 引入依赖3. 配置MQTT连接4. 创建MQTT配置类5. 实现消息发布与订阅

springboot项目打jar制作成镜像并指定配置文件位置方式

《springboot项目打jar制作成镜像并指定配置文件位置方式》:本文主要介绍springboot项目打jar制作成镜像并指定配置文件位置方式,具有很好的参考价值,希望对大家有所帮助,如有错误... 目录一、上传jar到服务器二、编写dockerfile三、新建对应配置文件所存放的数据卷目录四、将配置文

SpringBoot开发中十大常见陷阱深度解析与避坑指南

《SpringBoot开发中十大常见陷阱深度解析与避坑指南》在SpringBoot的开发过程中,即使是经验丰富的开发者也难免会遇到各种棘手的问题,本文将针对SpringBoot开发中十大常见的“坑... 目录引言一、配置总出错?是不是同时用了.properties和.yml?二、换个位置配置就失效?搞清楚加

怎么用idea创建一个SpringBoot项目

《怎么用idea创建一个SpringBoot项目》本文介绍了在IDEA中创建SpringBoot项目的步骤,包括环境准备(JDK1.8+、Maven3.2.5+)、使用SpringInitializr... 目录如何在idea中创建一个SpringBoot项目环境准备1.1打开IDEA,点击New新建一个项

Python中对FFmpeg封装开发库FFmpy详解

《Python中对FFmpeg封装开发库FFmpy详解》:本文主要介绍Python中对FFmpeg封装开发库FFmpy,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录一、FFmpy简介与安装1.1 FFmpy概述1.2 安装方法二、FFmpy核心类与方法2.1 FF

基于Python开发Windows屏幕控制工具

《基于Python开发Windows屏幕控制工具》在数字化办公时代,屏幕管理已成为提升工作效率和保护眼睛健康的重要环节,本文将分享一个基于Python和PySide6开发的Windows屏幕控制工具,... 目录概述功能亮点界面展示实现步骤详解1. 环境准备2. 亮度控制模块3. 息屏功能实现4. 息屏时间

springboot项目中整合高德地图的实践

《springboot项目中整合高德地图的实践》:本文主要介绍springboot项目中整合高德地图的实践,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一:高德开放平台的使用二:创建数据库(我是用的是mysql)三:Springboot所需的依赖(根据你的需求再