当前位置:网站首页>微信小程序留言板设计
微信小程序留言板设计
2022-04-22 17:12:00 【時間不夠以後】
微信小程序实现留言版的界面,主要涉及到了留言以及回复留言的界面。再设计的过程中,主要参考的是微信朋友圈的界面样式进行设计的。但仍存在瑕疵,同时有参考帖子提供的思路微信小程序第二篇:关于评论,和回复,以及再回复的实现和思考。
在设计的时候,由于后台传给我的只有一个留言信息的数组,所以我在request(后台传来的数据是根据最新时间进行排序的)后,对数据进行下面的处理,将存在的数据通过answer的值(answer=0就是默认留言)来存放到两个数组中msgReply[ ] 和 msgLeave[ ] 中
let msgLeave = []
let msgReply = []
res.data.data.forEach(element => {
if (element.answer === 0) {
element.children = []
msgLeave.push(element)
} else {
msgReply.push(element)
}
})
msgReply = msgReply.reverse() // 由于留言信息是通过最新时间返回的,这个回复的留言,应该是后留言的信息后显示,所以使用reverse()对数组重新排序
msgLeave.forEach(element => {
msgReply.forEach(element1 => {
if (element1.answer === element.id) {
element1.toAuthor = element.author
element.children.push(element1)
}
})
})
在设计的过程中,由于底部会有一个导航栏,所以我将input框设计在页面的头部,那么此时需要考虑的一个问题就是——将input框悬挂在页面的顶部。
wxml 设计
<view class="page-section">
<view class="textarea-wrp">
<textarea class="input_content" auto-height />
<button type="primary" bindtap='sendComment' class="btn">发送</button>
</view>
</view>
<view class="msg_detail ">
留言的显示
</view>
wxss 设计
.page-section{
position: fixed;
width: 100%;
/* margin-bottom: 60rpx; */
}
textarea {
width: 700rpx;
padding: 20rpx 2px;
margin: 8px 8px 8px 0;
background: #fff;
}
.textarea-wrp {
display: flex;
padding: 0 25rpx;
background: rgb(238, 238, 238);
}
.input_content {
background: #fff;
/* padding: 2px; */
font-size: 14px;
width: 90%;
height: 40px;
border-radius: 3px;
}
.btn {
width: 60px;
height: 30px;
font-size: 13px;
margin-top: 4%;
}
.msg_detail {
padding-top: 60px; /* 为了解决因为顶部悬停框position: fixed;引起的内容被遮挡的问题 */
}
关于小程序的具体页面详情,以及tabbar的解决见另外一篇博客
版权声明
本文为[時間不夠以後]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_43972213/article/details/97168328
边栏推荐
- bisect——对列表插入新数据仍然保持有序
- 2022年环境影响评价工程师考试相关法律法规练习题及答案
- Why do you have to override the hashcode method to override the equlas method
- 2022年环境影响评价工程师考试评价技术方法练习题及答案
- Find string in folder
- ASP.NET Core实现JWT授权与认证(2.实战篇)
- 2022年环境影响评价工程师考试技术导则与标准练习题及答案
- Shiro cache management
- Detailed explanation of kubernetes (VII) -- service object deployment and Application
- How can we make the calendar note of win10 computer display 24 solar terms?
猜你喜欢
随机推荐
bisect——对列表插入新数据仍然保持有序
MySQL笔记(基础篇)
ES6 Generator函数和async函数
ES6 Reflect对象
Sequoia China led the team and voted for two female founders
Write some magic statements found by leetcode
Add release configuration in clion
写LeetCode发现的一些神奇语句
Use appcube to quickly build 5g message service number with zero threshold
阿里云日志服务sls的典型应用场景
Detonate the most bombs - C language DFS recursive approach
15 ContentProvider
PHP AES加密解密
Network wide solicitation! Tell me the story between you and Yida
测试人生 | 毕业2年未满,0经验拿下知名互联网企业30W 年薪,他是怎么做到的?
js 获取汉字首字符
Which financial product has high income on May Day?
2022年环境影响评价工程师考试相关法律法规练习题及答案
从0开始设计_基于STM32F1的RC522读写卡
20220420 reasoning framework analyzes what is gradient








