提交 cd5b2d1a 编写于 作者: DCloud_JSON's avatar DCloud_JSON

修复 App 端,“会话操作菜单”弹出后,侧滑返回没有关闭菜单直接关闭会话页面的问题

上级 872f6251
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
@scroll="onScroll" @scroll="onScroll"
> >
<uni-im-conversation v-for="(item,index) in conversationList" :key="item.id" <uni-im-conversation v-for="(item,index) in conversationList" :key="item.id"
class="conversation-list-item" :class="{'activeConversation':activeConversationId == item.id,'focus':item.focus}" class="conversation-list-item" :class="{'activeConversation':activeConversationId == item.id,'focus':focusConversationId === item.id}"
:conversation="item" :id="item.id" :conversation="item" :id="item.id"
@click="clickItem(item)" @contextmenu.prevent="openConversationMenu($event,index)" @click="clickItem(item)" @contextmenu.prevent="openConversationMenu($event,index)"
@longpress="onScroll.isScrolling?'':openConversationMenu($event,index)" @longpress="onScroll.isScrolling?'':openConversationMenu($event,index)"
...@@ -74,6 +74,7 @@ export default { ...@@ -74,6 +74,7 @@ export default {
data() { data() {
return { return {
listScrollTop: 0, listScrollTop: 0,
focusConversationId: ''
} }
}, },
computed: { computed: {
...@@ -166,7 +167,7 @@ export default { ...@@ -166,7 +167,7 @@ export default {
}, },
openConversationMenu(e, index) { openConversationMenu(e, index) {
let conversation = this.conversationList[index] let conversation = this.conversationList[index]
conversation.focus = true this.focusConversationId = conversation.id
const myContextmenu = this.$refs['uni-im-contextmenu'] const myContextmenu = this.$refs['uni-im-contextmenu']
const clientY = e.clientY || e.changedTouches[0].clientY const clientY = e.clientY || e.changedTouches[0].clientY
...@@ -226,9 +227,13 @@ export default { ...@@ -226,9 +227,13 @@ export default {
] ]
myContextmenu.show(position, menuList) myContextmenu.show(position, menuList)
myContextmenu.onClose(() => { myContextmenu.onClose(() => {
conversation.focus = false this.focusConversationId = ''
}) })
}, },
closeConversationMenu(){
const myContextmenu = this.$refs['uni-im-contextmenu']
myContextmenu.closeMe()
},
async loadMore() { async loadMore() {
let data = await uniIm.conversation.loadMore() let data = await uniIm.conversation.loadMore()
// console.log('加载到新的会话数据',data); // console.log('加载到新的会话数据',data);
......
...@@ -305,6 +305,13 @@ ...@@ -305,6 +305,13 @@
}, },
onUnload() { onUnload() {
}, },
onBackPress(e) {
const clRef = this.$refs['uni-im-conversation-list']
if(clRef.focusConversationId){
clRef.closeConversationMenu()
return true
}
},
onHide() {}, onHide() {},
methods: { methods: {
clickMenu(data) { clickMenu(data) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册