|
@@ -79,6 +79,8 @@ export const chatInputMixin = {
|
|
|
},
|
|
|
watch: {
|
|
|
inputMsg (val, newval) {
|
|
|
+ this.fixIOS()
|
|
|
+
|
|
|
this.handleSelectionChange()
|
|
|
}
|
|
|
},
|
|
@@ -102,9 +104,13 @@ export const chatInputMixin = {
|
|
|
return false
|
|
|
},
|
|
|
handleFocus () {
|
|
|
+ this.fixIOS()
|
|
|
+
|
|
|
document.addEventListener('selectionchange', this.handleSelectionChange)
|
|
|
},
|
|
|
handleBlur () {
|
|
|
+ this.fixIOS(false)
|
|
|
+
|
|
|
document.removeEventListener('selectionchange', this.handleSelectionChange)
|
|
|
this.updateChatInputFocus(false)
|
|
|
},
|
|
@@ -115,6 +121,17 @@ export const chatInputMixin = {
|
|
|
let selectionStart = this.$refs.chatInput.selectionStart
|
|
|
let prevStr = this.inputMsg.slice(0, selectionStart)
|
|
|
this.selectionAfterAt = /@$/.test(prevStr)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @des 处理ios系统下窗体闪烁的bug
|
|
|
+ * @param {boolean} flag {true: 激活修复状态, false: 恢复原始状态}
|
|
|
+ */
|
|
|
+ fixIOS (flag = true) {
|
|
|
+ if (flag) {
|
|
|
+ this.$refs.scrollWrap.style.overflowY = 'hidden'
|
|
|
+ } else {
|
|
|
+ this.$refs.scrollWrap.style.overflowY = 'scroll'
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|