diff --git a/subPage/chat/index.js b/subPage/chat/index.js index e2301fa..22ca0c8 100644 --- a/subPage/chat/index.js +++ b/subPage/chat/index.js @@ -14,27 +14,6 @@ Page({ isUp:false, isDown:false, }, - { - id:-1, - type:'text', - isUp:false, - isDown:false, - content:'测试输入框发送测试输入框发送测试输入框发送测试输入框发送' - }, - { - id:0, - type:'text', - isUp:false, - isDown:false, - content:'我是AI回复,自定义回复' - }, - { - id:1, - type:'text', - isUp:false, - isDown:false, - content:'再次发送再次发送再次发送' - }, ] }, @@ -165,4 +144,33 @@ Page({ type:$type }); }, + + + + + // 文本消息发送 + handleSend(){ + let that = this; + if(that.data.sendText == ''){ + wx.showToast({ + title: '请输入内容', + icon: 'none', + }); + return false; + } + that.animate(); + that.setData({ + list:[ + ...that.data.list, + { + id:that.data.list.length, + type:'text', + isUp:false, + isDown:false, + content:that.data.sendText + } + ], + sendText:'' + }); + } }) \ No newline at end of file diff --git a/subPage/chat/index.wxml b/subPage/chat/index.wxml index 12d8e70..daeaf83 100644 --- a/subPage/chat/index.wxml +++ b/subPage/chat/index.wxml @@ -85,7 +85,9 @@ - +