|
@@ -79,6 +79,8 @@ export const chatInputMixin = {
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
inputMsg (val, newval) {
|
|
inputMsg (val, newval) {
|
|
|
|
+ this.fixIOS()
|
|
|
|
+
|
|
this.handleSelectionChange()
|
|
this.handleSelectionChange()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -102,9 +104,13 @@ export const chatInputMixin = {
|
|
return false
|
|
return false
|
|
},
|
|
},
|
|
handleFocus () {
|
|
handleFocus () {
|
|
|
|
+ this.fixIOS()
|
|
|
|
+
|
|
document.addEventListener('selectionchange', this.handleSelectionChange)
|
|
document.addEventListener('selectionchange', this.handleSelectionChange)
|
|
},
|
|
},
|
|
handleBlur () {
|
|
handleBlur () {
|
|
|
|
+ this.fixIOS(false)
|
|
|
|
+
|
|
document.removeEventListener('selectionchange', this.handleSelectionChange)
|
|
document.removeEventListener('selectionchange', this.handleSelectionChange)
|
|
this.updateChatInputFocus(false)
|
|
this.updateChatInputFocus(false)
|
|
},
|
|
},
|
|
@@ -115,6 +121,17 @@ export const chatInputMixin = {
|
|
let selectionStart = this.$refs.chatInput.selectionStart
|
|
let selectionStart = this.$refs.chatInput.selectionStart
|
|
let prevStr = this.inputMsg.slice(0, selectionStart)
|
|
let prevStr = this.inputMsg.slice(0, selectionStart)
|
|
this.selectionAfterAt = /@$/.test(prevStr)
|
|
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'
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|