微信小程序实现聊天界面,发送功能
创始人
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": "" } 

相关内容

热门资讯

科普分享“wepoker有没有... 科普分享“wepoker有没有插件”开挂(透视)辅助下载(安装教程有挂详细)【无需打开直接搜索加薇1...
透视辅助!agpoker辅助,... 【亲,竞技联盟辅助插件 这款游戏可以开挂的,确实是有挂的,很多玩家在这款竞技联盟辅助插件中打牌都会发...
让我来分享经验“hhpoker... hhpoker辅助器是一款可以让一直输的玩家,快速成为一个“必胜”的ai辅助神器,有需要的用户可以加...
透视辅助!pokemomo辅助... 您好:pokemomo辅助工具这款游戏可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌都会发现很多...
专业讨论“拱趴大菠萝自动计算机... 您好:这款游戏是可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌都会发现很多用户的牌特别好,总是好...
透视辅助!拱趴大菠萝十三水辅助... 【亲,淘宝买wepoker透视有用吗 这款游戏可以开挂的,确实是有挂的,很多玩家在这款淘宝买wepo...
一分钟了解“wepoker私人... 一分钟了解“wepoker私人辅助器”开挂(透视)辅助脚本(技巧教程有挂教程)您好:这款游戏可以开挂...
透视辅助!poker红龙辅助,... 透视辅助!poker红龙辅助,wpk辅助,推荐开挂辅助神器(透视有挂方法);无需打开直接搜索加(薇:...
技巧知识分享“wepoker辅... 技巧知识分享“wepoker辅助器软件下载”开挂(透视)辅助安装(可靠教程确实有挂)>>您好:软件加...
透视辅助!wepoker怎么下... 透视辅助!wepoker怎么下载游戏,pokemmo辅助器脚本下载,必看开挂辅助脚本(透视存在有挂)...