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开发Windows屏幕控制工具

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

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

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

一文详解如何在idea中快速搭建一个Spring Boot项目

《一文详解如何在idea中快速搭建一个SpringBoot项目》IntelliJIDEA作为Java开发者的‌首选IDE‌,深度集成SpringBoot支持,可一键生成项目骨架、智能配置依赖,这篇文... 目录前言1、创建项目名称2、勾选需要的依赖3、在setting中检查maven4、编写数据源5、开启热

Python实例题之pygame开发打飞机游戏实例代码

《Python实例题之pygame开发打飞机游戏实例代码》对于python的学习者,能够写出一个飞机大战的程序代码,是不是感觉到非常的开心,:本文主要介绍Python实例题之pygame开发打飞机... 目录题目pygame-aircraft-game使用 Pygame 开发的打飞机游戏脚本代码解释初始化部

SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志

《SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志》在SpringBoot项目中,使用logback-spring.xml配置屏蔽特定路径的日志有两种常用方式,文中的... 目录方案一:基础配置(直接关闭目标路径日志)方案二:结合 Spring Profile 按环境屏蔽关

使用Python开发一个现代化屏幕取色器

《使用Python开发一个现代化屏幕取色器》在UI设计、网页开发等场景中,颜色拾取是高频需求,:本文主要介绍如何使用Python开发一个现代化屏幕取色器,有需要的小伙伴可以参考一下... 目录一、项目概述二、核心功能解析2.1 实时颜色追踪2.2 智能颜色显示三、效果展示四、实现步骤详解4.1 环境配置4.

Python使用smtplib库开发一个邮件自动发送工具

《Python使用smtplib库开发一个邮件自动发送工具》在现代软件开发中,自动化邮件发送是一个非常实用的功能,无论是系统通知、营销邮件、还是日常工作报告,Python的smtplib库都能帮助我们... 目录代码实现与知识点解析1. 导入必要的库2. 配置邮件服务器参数3. 创建邮件发送类4. 实现邮件

MySQL版本问题导致项目无法启动问题的解决方案

《MySQL版本问题导致项目无法启动问题的解决方案》本文记录了一次因MySQL版本不一致导致项目启动失败的经历,详细解析了连接错误的原因,并提供了两种解决方案:调整连接字符串禁用SSL或统一MySQL... 目录本地项目启动报错报错原因:解决方案第一个:第二种:容器启动mysql的坑两种修改时区的方法:本地

springboot项目中使用JOSN解析库的方法

《springboot项目中使用JOSN解析库的方法》JSON,全程是JavaScriptObjectNotation,是一种轻量级的数据交换格式,本文给大家介绍springboot项目中使用JOSN... 目录一、jsON解析简介二、Spring Boot项目中使用JSON解析1、pom.XML文件引入依

基于Python开发一个有趣的工作时长计算器

《基于Python开发一个有趣的工作时长计算器》随着远程办公和弹性工作制的兴起,个人及团队对于工作时长的准确统计需求日益增长,本文将使用Python和PyQt5打造一个工作时长计算器,感兴趣的小伙伴可... 目录概述功能介绍界面展示php软件使用步骤说明代码详解1.窗口初始化与布局2.工作时长计算核心逻辑3