微信小程序实现聊天界面,发送功能
创始人
2024-12-15 18:36:58
0

在这里插入图片描述

.wxml

{windowHeight}}px;">   {chatList}}" wx:for-index="index" wx:for-item="item" style="padding-top:{{index==0?30:0}}rpx">          {item.id != userInfo.id}}">                {item.url}}" style="width: 35px; height: 35px; border-radius: 10px;">                       {{item.content}}                                       {{item.content}}                       {item.url}}" style="width: 35px; height: 35px; border-radius: 10px;">                      {bottomJP}}px; width: 100%; background-color: #fff; padding:  0 10rpx; box-shadow: 0 -2px 4px rgba(202, 202, 202, 0.1);height: 130rpx;display: flex;justify-content: space-around;align-items: center;padding-bottom: 30rpx;">          {false}}" bindfocus="getTelIptHeight" bindblur="getTelIptHeight" bindconfirm="sendContent" value="{{inputValue}}"/>                    

.js

const app = getApp() Page({    /**    * 页面的初始数据    */   data: {     tips: null,     windowHeight: 0,     windowWidtth: 0,     bottomJP: 0,     userInfo: {},     inputValue: '',     chatList: [{         createTime: '2024-07-24 09:10:00',         url: '/images/baochang.png',         content: '哈哈哈',         id: 8       },       {         createTime: '2024-07-24 11:15:30',         url: '/images/baochang.png',         content: '你好啊',         id: 9       },       {         createTime: '2024-07-24 11:15:30',         url: '/images/baochang.png',         content: '你好啊',         id: 9       },     ]   },   getTelIptHeight(e) {     console.log("height---------", e);     if (e.type == 'blur') {       this.setData({         bottomJP: 0       })     } else {       this.setData({         bottomJP: e.detail.height       })     }    },   onLoad(options) {     let that = this     that.setData({       userInfo: wx.getStorageSync("userInfo")     })     wx.getSystemInfo({       success: function (res) {         console.log(res)         that.setData({           windowHeight: res.windowHeight,           windowWidtth: res.windowWidth,         });       }     });     wx.setNavigationBarTitle({       title: '动态获取用户昵称',     })   },   send() {     let info = {       senderId: wx.getStorageSync("userInfo").id,       recipientId: 100,       chatContent: '你好啊~',       chatContentType: 'text'     }     let that = this     app.globalData.ws.send({       data: JSON.stringify(info),       success: (res) => {         console.log(res)         that.setData({           tips: "发送信息成功"         })       }     })   },   sendContent(e) {     let message = {       createTime: '2024-07-24 11:15:30',       url: '/images/baochang.png',       content: e.detail.value,       id: 9     }     let list = this.data.chatList     list.push(message)     this.setData({       chatList: list,       inputValue: ''     })   } }) 

.wxss

page {   background-color: #f4f5f7; } 

.json

{   "usingComponents": {},   "navigationBarTitleText": "" } 

相关内容

热门资讯

透视有挂!aapoker透视脚... 透视有挂!aapoker透视脚本下载,wepoker透视,分享教程(有挂脚本);1、任何aapoke...
WPK透视辅助!wepoke智... WPK透视辅助!wepoke智能ai(透视)总是是有挂(详细辅助揭秘攻略)是一款可以让一直输的玩家,...
wpk透视脚本链接!哈糖大菠萝... wpk透视脚本链接!哈糖大菠萝能开挂吗(透视)竟然是有挂(可靠教程);在进入哈糖大菠萝能开挂吗辅助挂...
透视代打!wpk透视脚本链接,... 透视代打!wpk透视脚本链接,wpk辅助插件叫什么,玩家爆料(有挂透明)1、快速入门:当你通过点击开...
透视玄学!wepoker透视脚... 透视玄学!wepoker透视脚本免费,wepoker透视脚本安卓,透明教程(有挂工具);暗藏猫腻,小...
wpk外挂!德扑ai智能机器人... wpk外挂!德扑ai智能机器人(透视)都是存在有挂(详细辅助实测交流);是一款可以让一直输的玩家,快...
wpk透视脚本链接!aapok... wpk透视脚本链接!aapoker怎么设置抽水(透视)果然真的有挂(德州论坛)1、点击下载安装,aa...
透视最新!wepoker辅助器... 透视最新!wepoker辅助器下载,aapoker辅助工具存在吗,科技分享(有挂攻略)1、aapok...
透视透视挂!hhpoker透视... 透视透视挂!hhpoker透视下载链接在哪里,红龙poker透视工具,玩家教你(有挂脚本)1、不需要...
德州ai人工智能!智星德州菠萝... 1、德州ai人工智能!智星德州菠萝(透视)先前是有挂(详细辅助必备科技)。2、德州ai人工智能透视辅...