网站首页 > 资源文章 正文
先上效果图
?
代码说明
- 引用
<view class="comment-view" wx:for="{{ comments.items }}">
<mp-comment item="{{item}}" bind:clickComment="clickComment" ></mp-comment>
</view>
- 布局文件
<!--assets/components/comment/comment.wxml-->
<view class="comment" hover-class="comment_hover" bindtap="clickComment" data-id="{{item.id}}" data-uid="{{item.user_id}}" data-name="{{item.user_name}}">
<view style="width:15%">
<image class="comment_head" mode='widthFix' src="{{item.uesr_head}}"/>
<view class="comment_content_name">
{{item.user_name}}
</view>
</view>
<view class="comment_content">
<!--文章标题-->
<view class="comment-article_name" wx:if="{{showName}}">{{item.article_name}}</view>
<!--父评论内容-->
<view class="comment-parent_view" wx:if="{{item.parent}}">
<view class="">
<view class="comment-son_content_text comment_content_text">{{item.parent.user_name}}:{{item.parent.content}}</view>
</view>
</view>
<!--本评论内容-->
<view class="comment_content_span">{{item.created_at}} 来自{{item.source}}</view>
<view class="comment_content_text">{{item.content}}</view>
<!--子评论内容-->
<view class="comment-son_view" wx:if="{{item.sons.length > 0}}">
<view class="" wx:for-items="{{item.sons}}" wx:for-item="son">
<view class="comment-son_content_text" hover-class="comment-son_content_text_hover" catchtap="clickComment" data-id="{{item.id}}" data-uid="{{son.user_id}}" data-name="{{son.user_name}}">{{son.user_name}} 回复 {{son.reply_user}}:{{son.content}}</view>
</view>
</view>
</view>
</view>
- 样式文件
/* assets/components/comment/comment.wxss */
.comment {
display: flex;
padding: 15px;
padding-left: 15px;
}
.comment_hover {
background-color:#eee
}
.comment-article_name {
font-size: 12px;
}
.comment_head {
border-radius: 50px;
width: 100%;
height: 100rpx;
margin-top: 10px;
}
.comment_content {
width: 75%;
background-color: #eee;
position: relative;
display: inline-block;
padding: 10px;
margin-left: 14px;
min-height: 55px;
z-index: 2;
}
.comment_content::before{
position: absolute;
left: -4px;
content: '';
width: 50px;
height: 50px;
border-style:solid;
border-width:2px;
border-color: #eee ;
border-radius:6px;
background-color: #eee;
transform:rotate(45deg);
z-index: -1;
}
.comment_content_name {
font-size: 12px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.comment_content_span {
font-size: 10px;
color: #a3a3a3;
}
.comment_content_text {
font-size: 12px;
}
.comment-parent_view {
border-bottom: 1rpx solid #ccc;
}
.comment-son_view {
margin-top: 10px;
border-top: 1rpx solid #ccc;
}
.comment-son-view_none {
display: none;
}
.comment-son {
display: flex;
padding: 15px;
padding-top: 0px;
padding-bottom: 0px;
}
.comment-son_content {
width: 72%;
margin-left: 8px;
}
.comment-son_content_text {
font-size: 12px;
color: #aaabbb;
}
.comment-son_content_text_hover {
background-color: #aaa;
color: #fff;
}
.comment-son_content_name {
font-size: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.comment-son_content::before{
width: 30px;
height: 30px;
}
- js文件
// assets/components/comment/comment.js
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
value: {},
},
showName: {
type: Boolean,
value: false,
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
clickComment: function (e) {
this.triggerEvent("clickComment", e.currentTarget.dataset)
}
}
})
- 上一篇: 掼蛋技巧实战:保留变形木板!学会这个技巧打掼蛋所向披靡
- 下一篇: C++ STL之(容器算法迭代器)
猜你喜欢
- 2024-11-18 第03章-linux常用命令
- 2024-11-18 Python的文件处理
- 2024-11-18 Redash中文版配置MySQL数据源
- 2024-11-18 域名批量查询功能常用查询方法教程
- 2024-11-18 js中的正则表达式入门
- 2024-11-18 C++ string/stack/list/deque/multiset 小结
- 2024-11-18 C++ STL之(容器算法迭代器)
- 2024-11-18 string 基本用法
- 2024-11-18 掼蛋技巧实战:保留变形木板!学会这个技巧打掼蛋所向披靡
- 2024-11-18 沈阳精品无抵消靓号 大厅过户
你 发表评论:
欢迎- 05-23如何制作含字母的流水条码
- 05-23NiceLabel又高出新境界,一分钟学会设计第一个标签
- 05-23商业设计中字体设计的创意方法
- 05-23条码软件如何调整条码数据的样式
- 05-23可变数据软件中条形码的制作步骤
- 05-23常用条形码类型组成及使用说明2
- 05-23条形码下面数据字号不一样大的UPC-A码怎么制作
- 05-23强烈推荐!这四款条形码生成工具超好用!
- 最近发表
- 标签列表
-
- 电脑显示器花屏 (79)
- 403 forbidden (65)
- linux怎么查看系统版本 (54)
- 补码运算 (63)
- 缓存服务器 (61)
- 定时重启 (59)
- plsql developer (73)
- 对话框打开时命令无法执行 (61)
- excel数据透视表 (72)
- oracle认证 (56)
- 网页不能复制 (84)
- photoshop外挂滤镜 (58)
- 网页无法复制粘贴 (55)
- vmware workstation 7 1 3 (78)
- jdk 64位下载 (65)
- phpstudy 2013 (66)
- 卡通形象生成 (55)
- psd模板免费下载 (67)
- shift (58)
- localhost打不开 (58)
- 检测代理服务器设置 (55)
- frequency (66)
- indesign教程 (55)
- 运行命令大全 (61)
- ping exe (64)
本文暂时没有评论,来添加一个吧(●'◡'●)