mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-28 03:00:49 +00:00
!2402 【Sample】code/Solutions/IM/Chat 输入框文字无法清空
Merge pull request !2402 from wenxusun/0230chat
This commit is contained in:
commit
c31769449a
6
code/Solutions/IM/Chat/.gitignore
vendored
6
code/Solutions/IM/Chat/.gitignore
vendored
@ -1,7 +1,7 @@
|
||||
/node_modules
|
||||
**/node_modules
|
||||
/local.properties
|
||||
/.idea
|
||||
**/build
|
||||
/.hvigor
|
||||
/package-lock.json
|
||||
/entry/package-lock.json
|
||||
**/package-lock.json
|
||||
**/.preview
|
@ -11,4 +11,4 @@
|
||||
"repository": {},
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ struct ChatDetailPage {
|
||||
msg2 = new TextMessage("我是好友消息2")
|
||||
tdate = new Date()
|
||||
megbody = new MessageBase("1", this.user1, this.user2, this.msg2, 1, this.tdate.getSeconds())
|
||||
keyboartStr: string
|
||||
@State keyboardStr: string = ''
|
||||
private chatDetailData = new ChatDetailData()
|
||||
private scroller: Scroller = new Scroller()
|
||||
@State wantParams: WantModel = new WantModel() // want的自定义参数
|
||||
@ -71,7 +71,7 @@ struct ChatDetailPage {
|
||||
}
|
||||
.key('moreBtn')
|
||||
.onClick(() => {
|
||||
router.push({
|
||||
router.pushUrl({
|
||||
url: "pages/ChatNewsPage",
|
||||
params: { NAME: router.getParams().chatName, IMAGEID: router.getParams().chatId }
|
||||
})
|
||||
@ -100,22 +100,23 @@ struct ChatDetailPage {
|
||||
Image($r('app.media.chatting_setmode_voice'))
|
||||
.height(20)
|
||||
.width(20)
|
||||
TextInput({ placeholder: "", text: "" })
|
||||
TextInput({ placeholder: "", text: this.keyboardStr })
|
||||
.key('bottomTextInput')
|
||||
.height(40)
|
||||
.width('80%')
|
||||
.enterKeyType(EnterKeyType.Send)
|
||||
.onChange((value: string) => {
|
||||
this.keyboartStr = value
|
||||
this.keyboardStr = value
|
||||
})
|
||||
.onSubmit((enterKey) => {
|
||||
this.tdate = new Date()
|
||||
let msg = new TextMessage(this.keyboartStr)
|
||||
let msg = new TextMessage(this.keyboardStr)
|
||||
let msgBody = new MessageBase(this.chatDetailData.totalCount()
|
||||
.toString(), this.user1, this.user2, msg, 1, this.tdate.getSeconds())
|
||||
this.chatDetailData.pushData(msgBody)
|
||||
this.msgLength = this.chatDetailData.totalCount()
|
||||
this.scroller.scrollToIndex(this.msgLength - 1)
|
||||
this.keyboardStr = ''
|
||||
})
|
||||
Image($r('app.media.chatting_expression'))
|
||||
.key('chatExpression')
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -30,7 +30,7 @@ export struct DiscoverPage {
|
||||
SettingItemView({ image: $r('app.media.find_friends'), text: "聊天社区" })
|
||||
}
|
||||
.onClick(() => {
|
||||
router.push({
|
||||
router.pushUrl({
|
||||
url: 'pages/FriendsMomentsPage'
|
||||
})
|
||||
})
|
||||
|
@ -15,4 +15,4 @@
|
||||
"@ohos/hvigor-ohos-plugin": "1.3.1",
|
||||
"@ohos/hvigor": "1.3.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user