效果
仿老福特实现的回复功能。
有内容时发布按钮改变状态,可点击,无内容不可点击
回复别人时,回复框出现回复xxx的字样
删除回复xxx,变为发布评论,不是回复评论
输入框里的回复xxx成为一个整体,要删除一起删除
当删除至输入框只剩回复xxx时,按删除键不删除内容,而是全部选中
拖动光标也要全部选中回复xxx
当回复二级回复时,后台只接收一级评论id,前端自己记录谁回复谁
输入框高度自适应,有最大高度
评论列表触底加载
html
css
.options *{ margin: 0; } .weui-cell:before{ border:0; } .weui-textarea{ line-height: 2; } .replay-list-button{ margin-left: 20px;white-space: nowrap;display: flex;align-items: center; } .reply{ padding: 10px 15px; height: auto; width: 100%; box-sizing: border-box; } .shenpi_show_bb:not(:first-of-type){ box-shadow: none; border-top: 1px solid #e7e7e7; } .reply_input_wrap { min-height: 40px; background: #f5f5f5; border-radius: 38px; width: 100%; flex-grow: 1; box-sizing: border-box; padding: 0 10px; max-height: 100px; overflow: auto; } .reply_input{ width: calc(100% - 30px); border: none; background: transparent; font-size: 16px; word-break: break-all; height: 38px; padding: 10px; box-sizing: border-box; overflow: hidden; display: block; color: #222; } .reply_input::placeholder{ color: #9B9B9B; } .first{ position: relative; margin-bottom: 21px; } .first::after{ content: ""; position: absolute; display: block; height: 1px; margin-left: 47px; width: calc(100% - 47px); background: #F1F1F1; } .send{ position: absolute; top: 0; bottom: 0; right: 5px; margin: auto; width: 24px!important; } .reply-list-wrap{ bottom: 0; padding-bottom: 60px; width: 100%; box-sizing: border-box; z-index: 1; } .reply-list{ padding: 0 20px 22px; width: 100%; box-sizing: border-box; bottom: 0; background-color: #fff; } .list-title{ display: flex; justify-content: space-between; align-items: center; font-weight: bold; font-size: 19px; font-family: PingFang SC; color: #222222; } .list-title img{ width: 22px; } .reply-list .list{ margin-top: 20px; position: relative; padding-left: 5px; } .reply-list .list .reply-list-item{ display: flex; padding-bottom: 23px; } .reply-list-item .avatar{ width: 40px; height: 40px; border-radius: 5px; margin-right: 13px; } .second .avatar{ width: 25px; height: 25px; } .name-date{ font-size: 14px; font-family: PingFang SC; font-weight: 500; color: #999999; display: flex; } .info p{ color: #999999; } .date{ margin-top: 5px; font-size: 14px; font-family: PingFang SC; font-weight: 500; color: #999999; } .name-date span:first-child{ margin-right: 10px; } .reply-content{ margin-top: 8px; display: flex; } .reply-content p{ font-size: 16px; font-family: PingFang SC; font-weight: 500; color: #222222!important; flex-grow: 1; } .reply-button-wrap{ margin-top: 16px; } .reply-button{ width: 23px; } .reply-button img{ width: 100%; pointer-events: none; } .info{ margin: 0; flex-grow: 1; } .second{ padding-left: 47px; box-sizing: border-box; } .second .name-date span{ display: block; } .second .name-date span:last-child{ margin-left: 0; } .list > p{ font-size: 14px; color: #cccccc; text-align: center; padding: 10px 0; } .list .layui-layer-loading, .list .layui-layer-content{ top: 0; left: 0; right: 0; bottom: 0; margin: auto; position: absolute; } .name-date .dot-span{ position: relative; margin: 0; } .dot{ width: 8px; height: 8px; border-radius: 50%; background: red; position: absolute; right: -8px; top: -8px;display: none; } .name-date .dot-span::after{ content: ""; display: block; width: 8px; height: 8px; border-radius: 50%; background: red; position: absolute; }
js