mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 11:13:26 +00:00
fix: ios键盘遮挡输入框的问题
This commit is contained in:
parent
117fd62c44
commit
ece17b2aee
5
resources/assets/js/functions/common.js
vendored
5
resources/assets/js/functions/common.js
vendored
@ -993,6 +993,11 @@
|
|||||||
if (!element) {
|
if (!element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (typeof options === "undefined" || options === true) {
|
||||||
|
options = {block: "start", inline: "nearest"}
|
||||||
|
} else if (options === false) {
|
||||||
|
options = {block: "end", inline: "nearest"}
|
||||||
|
}
|
||||||
if (typeof options.scrollMode !== "undefined" && typeof window.scrollIntoView === "function") {
|
if (typeof options.scrollMode !== "undefined" && typeof window.scrollIntoView === "function") {
|
||||||
window.scrollIntoView(element, options)
|
window.scrollIntoView(element, options)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -116,6 +116,9 @@ export default {
|
|||||||
observer: null,
|
observer: null,
|
||||||
wrapperWidth: 0,
|
wrapperWidth: 0,
|
||||||
editorHeight: 0,
|
editorHeight: 0,
|
||||||
|
|
||||||
|
timerScroll: null,
|
||||||
|
isSpecVersion: this.checkIOSVersion(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -295,10 +298,24 @@ export default {
|
|||||||
|
|
||||||
// Mark model as touched if editor lost focus
|
// Mark model as touched if editor lost focus
|
||||||
this.quill.on('selection-change', range => {
|
this.quill.on('selection-change', range => {
|
||||||
|
if (this.timerScroll) {
|
||||||
|
clearInterval(this.timerScroll);
|
||||||
|
}
|
||||||
if (!range) {
|
if (!range) {
|
||||||
this.$emit('on-blur', this.quill)
|
this.$emit('on-blur', this.quill)
|
||||||
} else {
|
} else {
|
||||||
this.$emit('on-focus', this.quill)
|
this.$emit('on-focus', this.quill)
|
||||||
|
if (this.isSpecVersion) {
|
||||||
|
// ios11.0-11.3 对scrollTop及scrolIntoView解释有bug
|
||||||
|
// 直接执行会导致输入框滚到底部被遮挡
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
$A.scrollToView(this.$refs.editor, true)
|
||||||
|
this.timerScroll = setInterval(() => {
|
||||||
|
$A.scrollToView(this.$refs.editor, true)
|
||||||
|
}, 300);
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -554,6 +571,14 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkIOSVersion() {
|
||||||
|
let ua = window && window.navigator && window.navigator.userAgent;
|
||||||
|
let match = ua.match(/OS ((\d+_?){2,3})\s/i);
|
||||||
|
let IOSVersion = match ? match[1].replace(/_/g, ".") : "unknown";
|
||||||
|
const iosVsn = IOSVersion.split(".");
|
||||||
|
return +iosVsn[0] == 11 && +iosVsn[1] >= 0 && +iosVsn[1] < 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user