微信小程序实现聊天对话微信小程序实现聊天对话(文本、图片文本、图片)功能功能
主要为大家详细介绍了微信小程序实现聊天对话功能,可以发送文本、图片,具有一定的参考价值,感兴趣的小伙伴们可
以参考一下
本文实例为大家分享了微信小程序实现聊天对话功能的具体代码,供大家参考,具体内容如下
这是我实际项目线上的代码, 或许有些不足 || 和你的需求不符合。
上图:
to_news.wxml
<!--pages/index/to_news/to_news.wxml-->
<view class='tab'>
<view class='lan'>{{tabdata.title}}</view>
<view class='tent'>
<text>{{tabdata.attribute_attribute}}</text>
<text class='fl_r '>{{tabdata.num}}</text>
</view>
<view class='xiahuaxian1'></view>
<view>
<text class='fabu'>发布时间: {{tabdata.time_agree}}</text>
</view>
</view>
<view class='news'>
<view class='xiahuaxian1 xiahuaxia'></view>
<view class='new_top_txt'>您正在与{{tabdata.nickname}}进行沟通</view>
<view class="historycon">
<scroll-view scroll-y="true" scroll-top="{{scrollTop}}" class="history" wx:for="{{centendata}}" wx:key=''>
<view>
<text class='time'>{{item.time}}</text>
</view>
<block wx:if="{{item.is_show_right ==1}}">
<view class='my_right'>
<view class='page_row'>
<text wx:if='{{!item.is_img}}' class='new_txt'>{{item.content}}</text>
<image wx:if='{{item.is_img}}' src='http://sz800800.cn/Uploads/{{item.content}}' class='new_imgtent'></image>
<view wx:if='{{!item.is_img}}' class='sanjiao my'></view>
<image class='new_img' wx:if='{{item.show_rignt == "是自己的内容,显示在右边,右边渲染 nickname_owner,head_owner"}}' src='{{item.head_owner}}'></image>
<image class='new_img' wx:if='{{item.show_rignt == "是自己的内容,显示在右边,右边渲染 nickname_open,head_open"}}' src='{{item.head_open}}'></image>
</view>
</view>
</block>
评论1