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

相关文章

基于 Cursor 开发 Spring Boot 项目详细攻略

《基于Cursor开发SpringBoot项目详细攻略》Cursor是集成GPT4、Claude3.5等LLM的VSCode类AI编程工具,支持SpringBoot项目开发全流程,涵盖环境配... 目录cursor是什么?基于 Cursor 开发 Spring Boot 项目完整指南1. 环境准备2. 创建

SpringBoot 多环境开发实战(从配置、管理与控制)

《SpringBoot多环境开发实战(从配置、管理与控制)》本文详解SpringBoot多环境配置,涵盖单文件YAML、多文件模式、MavenProfile分组及激活策略,通过优先级控制灵活切换环境... 目录一、多环境开发基础(单文件 YAML 版)(一)配置原理与优势(二)实操示例二、多环境开发多文件版

使用docker搭建嵌入式Linux开发环境

《使用docker搭建嵌入式Linux开发环境》本文主要介绍了使用docker搭建嵌入式Linux开发环境,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录1、前言2、安装docker3、编写容器管理脚本4、创建容器1、前言在日常开发全志、rk等不同

Three.js构建一个 3D 商品展示空间完整实战项目

《Three.js构建一个3D商品展示空间完整实战项目》Three.js是一个强大的JavaScript库,专用于在Web浏览器中创建3D图形,:本文主要介绍Three.js构建一个3D商品展... 目录引言项目核心技术1. 项目架构与资源组织2. 多模型切换、交互热点绑定3. 移动端适配与帧率优化4. 可

sky-take-out项目中Redis的使用示例详解

《sky-take-out项目中Redis的使用示例详解》SpringCache是Spring的缓存抽象层,通过注解简化缓存管理,支持Redis等提供者,适用于方法结果缓存、更新和删除操作,但无法实现... 目录Spring Cache主要特性核心注解1.@Cacheable2.@CachePut3.@Ca

Python实战之SEO优化自动化工具开发指南

《Python实战之SEO优化自动化工具开发指南》在数字化营销时代,搜索引擎优化(SEO)已成为网站获取流量的重要手段,本文将带您使用Python开发一套完整的SEO自动化工具,需要的可以了解下... 目录前言项目概述技术栈选择核心模块实现1. 关键词研究模块2. 网站技术seo检测模块3. 内容优化分析模

SpringBoot通过main方法启动web项目实践

《SpringBoot通过main方法启动web项目实践》SpringBoot通过SpringApplication.run()启动Web项目,自动推断应用类型,加载初始化器与监听器,配置Spring... 目录1. 启动入口:SpringApplication.run()2. SpringApplicat

基于Java开发一个极简版敏感词检测工具

《基于Java开发一个极简版敏感词检测工具》这篇文章主要为大家详细介绍了如何基于Java开发一个极简版敏感词检测工具,文中的示例代码简洁易懂,感兴趣的小伙伴可以跟随小编一起学习一下... 目录你是否还在为敏感词检测头疼一、极简版Java敏感词检测工具的3大核心优势1.1 优势1:DFA算法驱动,效率提升10

Python进阶之列表推导式的10个核心技巧

《Python进阶之列表推导式的10个核心技巧》在Python编程中,列表推导式(ListComprehension)是提升代码效率的瑞士军刀,本文将通过真实场景案例,揭示列表推导式的进阶用法,希望对... 目录一、基础语法重构:理解推导式的底层逻辑二、嵌套循环:破解多维数据处理难题三、条件表达式:实现分支

聊聊springboot中如何自定义消息转换器

《聊聊springboot中如何自定义消息转换器》SpringBoot通过HttpMessageConverter处理HTTP数据转换,支持多种媒体类型,接下来通过本文给大家介绍springboot中... 目录核心接口springboot默认提供的转换器如何自定义消息转换器Spring Boot 中的消息