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

相关文章

JAVA项目swing转javafx语法规则以及示例代码

《JAVA项目swing转javafx语法规则以及示例代码》:本文主要介绍JAVA项目swing转javafx语法规则以及示例代码的相关资料,文中详细讲解了主类继承、窗口创建、布局管理、控件替换、... 目录最常用的“一行换一行”速查表(直接全局替换)实际转换示例(JFramejs → JavaFX)迁移建

JavaWeb项目创建、部署、连接数据库保姆级教程(tomcat)

《JavaWeb项目创建、部署、连接数据库保姆级教程(tomcat)》:本文主要介绍如何在IntelliJIDEA2020.1中创建和部署一个JavaWeb项目,包括创建项目、配置Tomcat服务... 目录简介:一、创建项目二、tomcat部署1、将tomcat解压在一个自己找得到路径2、在idea中添加

解决idea启动项目报错java: OutOfMemoryError: insufficient memory

《解决idea启动项目报错java:OutOfMemoryError:insufficientmemory》:本文主要介绍解决idea启动项目报错java:OutOfMemoryError... 目录原因:解决:总结 原因:在Java中遇到OutOfMemoryError: insufficient me

python项目环境切换的几种实现方式

《python项目环境切换的几种实现方式》本文主要介绍了python项目环境切换的几种实现方式,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 目录1. 如何在不同python项目中,安装不同的依赖2. 如何切换到不同项目的工作空间3.创建项目

SpringBoot项目整合Netty启动失败的常见错误总结

《SpringBoot项目整合Netty启动失败的常见错误总结》本文总结了SpringBoot集成Netty时常见的8类问题及解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参... 目录一、端口冲突问题1. Tomcat与Netty端口冲突二、主线程被阻塞问题1. Netty启动阻

python项目打包成docker容器镜像的两种方法实现

《python项目打包成docker容器镜像的两种方法实现》本文介绍两种将Python项目打包为Docker镜像的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要... 目录简单版:(一次成功,后续下载对应的软件依赖)第一步:肯定是构建dockerfile,如下:第二步

Python + Streamlit项目部署方案超详细教程(非Docker版)

《Python+Streamlit项目部署方案超详细教程(非Docker版)》Streamlit是一款强大的Python框架,专为机器学习及数据可视化打造,:本文主要介绍Python+St... 目录一、针对 Alibaba Cloud linux/Centos 系统的完整部署方案1. 服务器基础配置(阿里

SpringBoot+Vue3整合SSE实现实时消息推送功能

《SpringBoot+Vue3整合SSE实现实时消息推送功能》在日常开发中,我们经常需要实现实时消息推送的功能,这篇文章将基于SpringBoot和Vue3来简单实现一个入门级的例子,下面小编就和大... 目录前言先大概介绍下SSE后端实现(SpringBoot)前端实现(vue3)1. 数据类型定义2.

Python+wxPython开发一个文件属性比对工具

《Python+wxPython开发一个文件属性比对工具》在日常的文件管理工作中,我们经常会遇到同一个文件存在多个版本,或者需要验证备份文件与源文件是否一致,下面我们就来看看如何使用wxPython模... 目录引言项目背景与需求应用场景核心需求运行结果技术选型程序设计界面布局核心功能模块关键代码解析文件大

C++多线程开发环境配置方法

《C++多线程开发环境配置方法》文章详细介绍了如何在Windows上安装MinGW-w64和VSCode,并配置环境变量和编译任务,使用VSCode创建一个C++多线程测试项目,并通过配置tasks.... 目录下载安装 MinGW-w64下载安装VS code创建测试项目配置编译任务创建 tasks.js