diff --git a/resources/assets/js/functions/common.js b/resources/assets/js/functions/common.js index abe6c5524..abb322ea7 100755 --- a/resources/assets/js/functions/common.js +++ b/resources/assets/js/functions/common.js @@ -1045,6 +1045,21 @@ } }, + /** + * 按需滚动到View + * @param element + */ + scrollIntoViewIfNeeded(element) { + if (!element) { + return; + } + if (typeof element.scrollIntoViewIfNeeded === "function") { + element.scrollIntoViewIfNeeded() + } else { + $A.scrollToView(element, {block: "nearest", inline: "nearest"}) + } + }, + /** * 等比缩放尺寸 * @param width diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index e3edf3b11..59aeb297b 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -1030,10 +1030,7 @@ export default { this.$nextTick(() => { const active = this.$refs.menuProject.querySelector(".active") if (active) { - $A.scrollToView(active, { - behavior: 'instant', - scrollMode: 'if-needed', - }); + $A.scrollIntoViewIfNeeded(active); } }); }).catch(({msg}) => { diff --git a/resources/assets/js/pages/manage/components/ChatInput/index.vue b/resources/assets/js/pages/manage/components/ChatInput/index.vue index 8019a1aad..f11036b97 100755 --- a/resources/assets/js/pages/manage/components/ChatInput/index.vue +++ b/resources/assets/js/pages/manage/components/ChatInput/index.vue @@ -385,7 +385,7 @@ export default { } else if (!this.$isDesktop) { this.timerScroll = setInterval(() => { if (this.quill?.hasFocus()) { - this.$refs.editor.scrollIntoViewIfNeeded(); + $A.scrollIntoViewIfNeeded(this.$refs.editor); } else { clearInterval(this.timerScroll); } diff --git a/resources/assets/js/pages/manage/components/DialogView.vue b/resources/assets/js/pages/manage/components/DialogView.vue index 4683fba69..5d37045e0 100644 --- a/resources/assets/js/pages/manage/components/DialogView.vue +++ b/resources/assets/js/pages/manage/components/DialogView.vue @@ -10,7 +10,10 @@